[crac] RFR: Handle open file descriptors with configurable policies [v9]
Radim Vansa
rvansa at openjdk.org
Tue Jul 4 08:12:27 UTC 2023
On Mon, 3 Jul 2023 16:46:17 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:
>> Radim Vansa has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Cosmetic fixes (imports)
>
> src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java line 64:
>
>> 62: // might read configuration files with this or later priority.
>> 63: // It's difficult to trigger static initialization outside the package.
>> 64: Core.Priority.PRE_FILE_DESCRIPTORS.getContext().register(resourceProxy);
>
> The change looks safe but not clear. The resourceProxy eventually calls FileDispatcherImpl.beforeCheckpoint, that closes preClose sockets, blocking FDI.preClose() operation. Does the problem appear when a configuration file is closed? Or is it just registration to NORMAL priority when it is being processed already?
The problem with registration at NORMAL level is that this is the same level as OpenResourcePolicies registers to, in order to fetch the configuration just before the checkpoint (to allow dynamic configuration from within the app). When ORP.beforeCheckpoint opens the configuration file and this is the first moment FDI is used (triggering the static initialization) this results in FDI registering with the priority that is already being executed - depending on the context impl this either blocks or the FDI resourceProxy is not called.
Ideally I would trigger clinit for FDI from FileDescriptor and ensure that it's already registered before checkpoint, but haven't found any simple way to do that.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/69#discussion_r1251659959
More information about the crac-dev
mailing list