RFR: 8316337: (bf) Concurrency issue in DirectByteBuffer.Deallocator [v3]
Chen Liang
liach at openjdk.org
Tue Sep 19 00:58:38 UTC 2023
On Mon, 18 Sep 2023 19:09:07 GMT, Brent Christian <bchristi at openjdk.org> wrote:
>>> If only one cleaner thread runs, can we just safely assume it is run only once and simply remove the `deallocated` check, which only defends against some, but not all, of those erroneous situations?
>>
>> Cleaner specifies that it is run once so yes, I think flag can be dropped, as well as checking if the address is 0.
>
> `address` can't be 0 if asserts a enabled. Might `address` be 0 if asserts **_aren't_** enabled?
This constructor is only used from DirectXBuffer constructors (line 142), and the passed address is the return value of `Unsafe.allocateMemory` (line 129). We can trust `address` as long as we trust the unsafe method.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15784#discussion_r1329428912
More information about the nio-dev
mailing list