-
Notifications
You must be signed in to change notification settings - Fork 143
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
Flush stdout after outputting debug message #1160
Conversation
TextIO.output() doesn't flush stdout, but print() does. Flushing is necessary to make sure the messages are printed in a timely fashion, which is important when debugging timing/performance issues. The performance hit of the extra flushing should be negligible, as even when these debug messages are enabled, they are only printed a few dozen times or so.
This segmentation fault in the docker test seems quite concerning, although I'd be surprised if it was related to this PR... |
Thanks for this! The issue with |
It's really hard for me to say for sure as I haven't been able to reproduce that problem, but I found polyml/polyml#189, which might be what is causing that segfault. If so, I think I figured out how to reproduce it, as I mentioned in my comment on that issue: polyml/polyml#189 (comment) |
I'm now pretty sure that this is exactly the bug that is causing the CI failures. In a previous comment I quoted the failing message:
The $ grep -F Date.fmt examples/dev -r
examples/dev/vsynth.sml:fun date() = Date.fmt "%c" (Date.fromTimeLocal (Time.now ())); |
Aha; many thanks for all of the detective work that has led to this point! I will provide a stub implementation of |
See discussion and detective work by someplaceguy on github issues #1160 and polyml/polyml#189.
Sure, no problem! However, note that there are also other examples that will likely run into the same issue. Specifically, these ones: $ grep -F 'Date.fmt "%c"' . -r
./examples/dev/vsynth.sml:fun date() = Date.fmt "%c" (Date.fromTimeLocal (Time.now ()));
./examples/acl2/ml/sexp.sml:fun date() = Date.fmt "%c" (Date.fromTimeLocal (Time.now ()));
./examples/acl2/examples/M1/sexp.sml:fun date() = Date.fmt "%c" (Date.fromTimeLocal (Time.now ()));
./examples/acl2/examples/acl2-hol-ltl-paper-example/sexp.sml:fun date() = Date.fmt "%c" (Date.fromTimeLocal (Time.now ())); As an alternative to stubbing |
@someplaceguy thank you so much for finding out the root cause of this annoy Poly/ML crashing. So it doesn't crash on macOS (which I use daily) because the bug is in glibc on Linux (at least). It's definitely possible to force the locale to C in docker CI builds but this is no more necessary since Michael has disabled the time printing in |
The
prefix. Other executables that HOL builds but doesn't necessarily control all invocations of would just have to be invoked with that prefix in Holmakefiles that call them. (And other users would just have to know to do it I guess.) |
TextIO.output() doesn't flush stdout, but print() does. Flushing is necessary to make sure the messages are printed in a timely fashion, which is important when debugging timing/performance issues.
The performance hit of the extra flushing should be negligible, as even when these debug messages are enabled, they are only printed a few dozen times or so.