RFR: 8256008: UL does not report anything if disk writing fails
Thomas Stuefe
stuefe at openjdk.java.net
Sun Nov 8 08:15:55 UTC 2020
On Sat, 7 Nov 2020 07:19:09 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
> If there are no disk space enough to write UL, it does not report. So the user cannot know lack of logs timely.
>
> `LogFileStreamOutput::write()` uses `jio_fprintf()` and `fflush()` to write log. However return values from them would not be checked.
> We should check them, and should report what happened if error occurred.
>
>
> How to reproduce on Linux:
>
> 1. Mount tmpfs with 512K
>
> $ mkdir /tmp/tmp
> $ mount -t tmpfs -o size=512k tmpfs /tmp/tmp
>
> 2. Run `java` with `-Xlog`
>
> $ java -Xlog:all=trace:file=/tmp/tmp/all.log --version
Hi Yasumasa,
This fix makes sense.
Not a full review, just some initial remarks:
- A simpler way to reproduce may be to set an IO quota with ulimit. We ignore SIGXFSZ, so this should make the io calls fail. This could also maybe used for a jtreg test, though I see that this could be a bit more work and I won't insist on it.
- I would like it if we could attempt to write some final words into the log stream. Because that may still work, even if the larger output does not (I really hope we do not print characters individually, don't we?). Something like `("write failed (%d)", errno)`. That may or may not work but if it does its helpful when looking at the logfile.
- If you handle errors from writing, make sure you handle intermittend write errors correctly. You probably want to handle EINTR by re-trying to write.
- I see you make an RAII object to handle flock. Could you leave this out please to make this change easier to review? I am not against it, but would prefer this in a separate cleanup change.
More remarks later.
Thanks, Thomas
-------------
PR: https://git.openjdk.java.net/jdk/pull/1106
More information about the hotspot-runtime-dev
mailing list