[crac] RFR: Handle open file descriptors with configurable policies [v6]

Radim Vansa rvansa at openjdk.org
Fri Jun 16 14:30:31 UTC 2023

On Fri, 16 Jun 2023 13:14:14 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>>   cleanup
> src/java.base/share/classes/jdk/crac/impl/OpenFilePolicies.java line 220:
>> 218:          * and opens the file at the end.
>> 219:          */
>> 220:         OPEN_OTHER_AT_END,
> Semantically, these modes are the same, the second is for FD opened in APPEND mode. But having both modes allows changing the FD mode for the application. Such change will break app assumptions about the file descriptor.

There's many ways that you could break an application invariant if the file is changed/removed when the application thinks it has exclusive write access to it, e.g. it might not expect to write files bigger than X because it streams at most X bytes to that, but if you change the position during reopening you might violate that expectation. These are different options to handle that case: if you think the simplicity of use outweighs the choice I can make OPEN_OTHER use the _AT_END semantics when the file was opened for appending.


PR Review Comment: https://git.openjdk.org/crac/pull/69#discussion_r1232327454

More information about the crac-dev mailing list