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

isaac_seed assert #3679

Closed
jesse99 opened this issue Oct 6, 2012 · 3 comments
Closed

isaac_seed assert #3679

jesse99 opened this issue Oct 6, 2012 · 3 comments
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Milestone

Comments

@jesse99
Copy link
Contributor

jesse99 commented Oct 6, 2012

Noticed the following when running my app: Assertion failed: (ret == 0), function isaac_seed, file /Users/jessejones/Source/Third_Party/rust/src/rt/rust_util.h, line 153. Doesn't seem especially reproducible.

Looking at the header:

  • The assert is firing when trying to close a /dev/urandom file descriptor. I can see checking for errors on a descriptor being written to (the close will often flush buffered data), but failing because close failed for reads seems a lot iffier.
  • All the error checking in isaac_seed (including Windows) is using asserts which seems questionable: usually those should be reserved to catch errors programmers make, not arbitrary errors the runtime will throw up (especially if those errors may be ifdef'ed out).
  • It'd be great if the Unix code used perror.

This was on a Mac. I note that man 2 close lists three reasons why close may fail including the perennial favorite "execution was interrupted by a signal".

@jesse99
Copy link
Contributor Author

jesse99 commented Oct 6, 2012

It's definitely intermittent, but bad enough that I wound up replacing the assert with an fwrite. Interestingly once I finally reproed it perror said that the problem was "Bad file descriptor".

@bblum
Copy link
Contributor

bblum commented Oct 11, 2012

Odd. Definitely related: #2870 and its fix 60d682b.

jesse99 added a commit to jesse99/rust that referenced this issue Nov 18, 2012
1) Check for eof (shouldn't happen, but if it does we'll fall into an
infinite loop).
2) Use fatal instead of assert (will work if NDEBUG is ever defined
and provides better diagnostics).
3) Ignore errors from close since they shouldn't matter.

Closes rust-lang#3679.
@brson brson mentioned this issue Nov 18, 2012
@brson
Copy link
Contributor

brson commented Nov 25, 2012

I do think we should be doing this check for the closed file descriptor (it caught this error!), but for now we can turn it off as a bandaid.

@brson brson closed this as completed in 8adacc0 Nov 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

3 participants