[crac] RFR: Handle open file descriptors with configurable policies [v9]
Anton Kozlov
akozlov at openjdk.org
Tue Jul 4 16:56:22 UTC 2023
On Tue, 4 Jul 2023 08:17:42 GMT, Radim Vansa <rvansa at openjdk.org> wrote:
>> src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java line 212:
>>
>>> 210: // the FD value set breaks JDKSocketResource (we don't want the extra
>>> 211: // test if the FD resource has been marked).
>>> 212: fdAccess.closeNoCleanup(fd);
>>
>> Should not it be just `close()`ed? `unregisterCleanup` looks to be idempotent. And I remember you had a mail thread regarding this close/close0, could you remind the link?
>
> Do you mean this thread? https://mail.openjdk.org/pipermail/nio-dev/2023-January/013075.html
>
> Well this was meant to change the behaviour as little as possible. All the ways the FD can be closed looks pretty spaghetti to me; I can give the regular close a go and see what breaks...
Oh, sorry, I did not mean to make it more dangerous, just in the previous version it was rather inconsistent (the method is called closeAndMark, but apparently no marking was going to happen).
Thank you for the link. Does that mean that NIO does not reset FD just because that is not necessary?
And could you elaborate on why we don't want the extra test for the mark? Since we need more accurate tracking of the FD state, including close() from NIO, but we don't want to change the existing FD behavior, adding the check to JDKSocketResource would be pretty straightforward.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/69#discussion_r1252228933
More information about the crac-dev
mailing list