-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
troubles building deno in case of slow download of librusty_v8.a #8449
Comments
As a workaround: https://github.com/denoland/rusty_v8#the-rusty_v8_mirror-environment-variable - precache the .a and tell the build script where to find it. My hunch is that it's not a race condition but that the download finished prematurely (i.e., partial download.) Perhaps we can fix that on the rusty_v8 side by checksumming the download. |
thanks for this hint, although i wouldn't see it as a proper solution concerning this issue.
no -- it's very simple to reproduce on any slow connected machine! but even on a fast connected machine you should be able to simulate the problem by utilizing some traffic shaping software or similar web testing tools. the issue doesn't effect the rusty_v8 crate, if you only built it standalone. it's therefore much more likely caused by some kind of concurrency within the deno build, which doesn't satisfactorily watch out for a finished execution resp. download of this particular build dependency. |
here is a precise log file file of the execution-log.txt in the terminal output we find entries reporting:
before the error, but also once again at the end:
|
I'm not able to reproduce what you're seeing, even when I slow down the download speed to a few kb/s. I also don't see how it can happen. rusty_v8's You're using nightly builds of cargo/rustc, aren't you? Can you try with stable? |
no -- i just used nightly for this single run, because the timing reports aren't available in stable, but otherwise i always used the most recent (1.48) stable release. the behavior is exactly the same in both of them.
yes -- but it's running twice!
hmm -- on my machine it's perfectly reproducible on any run.... the issue looks more obvious, if you look for this significant section on a
there are two build script invocations running in parallel, and the second one runs/finishes quite fast, because it assumes, that the lib is already available on the machine, although the file gets still downloaded by the first instance... this triggers the i think i found a rather simple solution for this issue by utilizing lockfiles, which will block any further processing of rusty_v8 till the download completes (see: denoland/rusty_v8#543). i hope it is compatible to all platforms. |
while updating all the installed rust binaries on my machine utilizing as demonstrated in denoland/rusty_v8#545 it's a perfectly reproducible flaw in the rusty_v8 build script, which affects nearly anybody using cargo to build deno from source. it's just a typical race problem, which unfortunately isn't visible on first sight resp. reported in a more helpful and unambiguous manner on the terminal. @bartlomieju if someone finds a better solution than my lock file suggestion -- e.g. by wrapping the static library download in a additional pseudo crate to utilize the already available cargo build infrastructure and its download monitoring to avoid the present troubles --, that's perfectly acceptable to me, but simply ignoring/deny such a grave bug is IMHO indisputable. |
Fix landed in |
@bartlomieju |
there already a few bug reports available documenting this
error: failed to add native library /tmp/deno/target/release/gn_out/obj/librusty_v8.a: truncated or malformed archive (offset to next archive member past the end of the archive after member /)
issue (eg. #7115, #7517, #8385), but i think, most of them could be caused by some kind of strangerace condition
during the build process, if your internet connection is very slow and the download oflibrusty_v8.a
(~50MB in release mode and 150MB in case of the debug version) takes to long, because other parts of the build process already see/use the incomplete archive and trigger this error:in practice it looks very strange to the user, because there is no warning or progress report about this background task visible and looks more like the build process somehow hangs, because it's still downloading after this fatal error message and doesn't come back...
if you build deno in a local cloned repo, it will at least succeed on a second invocation of
cargo build
-- as long as you didn't stop the background download by an hard interrupt. but this workaround will not help in case ofcargo install deno
, because it's always using a different directory for build resp. download on any successive run. in this case you will most likely just reproduce a very similar behavior on every further invocation.The text was updated successfully, but these errors were encountered: