RFR: 8303942: os::write should write completely [v3]
Afshin Zafari
duke at openjdk.org
Sun May 7 09:42:33 UTC 2023
On Sat, 6 May 2023 03:14:43 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8303942: os::write should write completely
>
> src/hotspot/share/jfr/recorder/repository/jfrEmergencyDump.cpp line 375:
>
>> 373: current_fd = open_exclusivly(fqn);
>> 374: if (current_fd != invalid_fd) {
>> 375: const size_t size = (size_t)file_size(current_fd);
>
> There's an existing bug here: error code of -1 from `file_size` is not handled.
The type is returned to signed and the assert checks the -1.
> src/hotspot/share/jfr/writers/jfrStreamWriterHost.inline.hpp line 82:
>
>> 80: JfrJavaSupport::abort("Failed to write to jfr stream because no space left on device", false);
>> 81: }
>> 82: guarantee(num_written == 0, "Not all the bytes got written, or os::write() failed");
>
> guarantee() seems to be a bad way of handling this. I would suggest filing an RFE for more robust error handling.
This RFE is created:
https://bugs.openjdk.org/browse/JDK-8307579
The return values of the os::write in jfrStreamWriterHost.inline.hpp:StreamWriterHost<Adapter, AP>::write_bytes(), should be handled more robustly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13750#discussion_r1186818028
PR Review Comment: https://git.openjdk.org/jdk/pull/13750#discussion_r1186818167
More information about the hotspot-dev
mailing list