Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: fix lstat error on outDir. Closes #465 #461

Merged
merged 4 commits into from
May 16, 2024
Merged

Conversation

juliangruber
Copy link
Member

@juliangruber juliangruber commented May 14, 2024

@bajtos I have finally been able to reproduce the lstat errors that are reported so often. And for me, the only way to recover was this quick fix. I didn't have time to look into it more properly.

Since the diff is indentation heavy, the gist is this: Remove the try/catch that removes outDir when the download failed. I don't know why this fixes it, or whether this introduces regressions.

Closes #465

@juliangruber juliangruber requested a review from bajtos May 14, 2024 12:53
@bajtos
Copy link
Member

bajtos commented May 14, 2024

Since the diff is indentation heavy

It's easy to tell GitHub to ignore whitespaces and fortunately, your PR is very easy to understand that way.

https://github.com/filecoin-station/core/pull/461/files?diff=unified&w=1

Screenshot 2024-05-14 at 14 59 12

@bajtos
Copy link
Member

bajtos commented May 14, 2024

I have finally been able to reproduce the lstat errors that are reported so often.

Awesome!

And for me, the only way to recover was this quick fix. I didn't have time to look into it more properly.
Since the diff is indentation heavy, the gist is this: Remove the try/catch that removes outDir when the download failed. I don't know why this fixes it, or whether this introduces regressions.

I guess await rm(outDir, { recursive: true }) is calling lstat when recursively deleting files & directories, and that operation fails. When you remove the recursive removal, we no longer call lstat. That is my assumption as to why your fix works.

I found the following GH issues mentioning lstat:

They all are caused by lstat failing on $ROOT/sources/$MODULE.

Regarding regressions: I think your change is going to break the logic detecting when it's safe to skip downloading the version because we have already downloaded it before; see here:

https://github.com/filecoin-station/core/blob/9d112af58a47119c01b39d8940c80ce08577594c/lib/modules.js#L145-L155

@juliangruber
Copy link
Member Author

juliangruber commented May 14, 2024

what about this: ignore enoent errors here

Isn't this going to break #336?

Prevent that source code updates create inconsistent folder structures, when residue files are kept around

@juliangruber juliangruber changed the title modules: fix lstat error on outDir modules: fix lstat error on outDir. Closes #465 May 14, 2024
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the comment above, the change LGTM 👍🏻

I am fine with shipping it and seeing how it works in practice.

@juliangruber
Copy link
Member Author

Other than the comment above, the change LGTM 👍🏻

I am fine with shipping it and seeing how it works in practice.

Which comment above? Do you mean my comment that you edited? 😅

@juliangruber
Copy link
Member Author

what about this: ignore enoent errors here

Isn't this going to break #336?

Prevent that source code updates create inconsistent folder structures, when residue files are kept around

It isn't going to break #336, because in the case of an ENOENT, there is no directory to clean up in the first place.

Let's ship it and see 👍

@juliangruber juliangruber merged commit baedda6 into main May 16, 2024
18 checks passed
@juliangruber juliangruber deleted the fix/lstat branch May 16, 2024 03:31
@bajtos
Copy link
Member

bajtos commented May 16, 2024

Do you mean my comment that you edited?

😱

I wanted to copy the content from your comment to quote it in my comment. Apparently, I modified your comment instead. Sorry for that! 🙈

what about this: ignore enoent errors here

Isn't this going to break #336?

Prevent that source code updates create inconsistent folder structures, when residue files are kept around

It isn't going to break #336, because in the case of an ENOENT, there is no directory to clean up in the first place.

Ah, I was under the assumption that ENOENT could also be triggered for nested directories. However, all bug reports show only ENOENT for the top-level directory. Your assessment looks correct to me now. 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Core is unable to download Spark sources
2 participants