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

Radim Vansa rvansa at openjdk.org
Mon Jul 3 14:53:20 UTC 2023


On Mon, 3 Jul 2023 14:24:32 GMT, Radim Vansa <rvansa at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/FileDescriptor.java line 75:
>> 
>>> 73:                     claimedFDs.claimFd(self, self, null);
>>> 74:                 }
>>> 75: 
>> 
>> Can we have a policy for a FileDescriptor to prevent it from throwing an exception? Suppose we have an issue that a FileDescriptor throws due to a race, e.g. a containing object referring to an FD was GCed, FD is about to be GCed, but still alive, so FD will throw an exception. It will be useful to suppress the exception by the configuration, although of course, it's discouraged.
>
> How would you expect to specify *which* FD should not throw, without fetching the details through native code? Would a numeric identifier (or full wildcard) be sufficient?

Alternatively, we could change the claiming process to create a FD -> higher resource reference when the FD is accepted in the resource (constructor or setter), preventing this altogether from happening. Regrettably one FD would have to be able to reference multiple resources this way, though.

-------------

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


More information about the crac-dev mailing list