-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
22
When a thread T closes a shared arena, the following operations are performed:
1. check that the session is still alive
2. put the session in the CLOSING state - from this point on, any subsequent attempt to access the segment will throw ISE (because MemorySession::checkValidState will fail - assuming they see the new value)
3. start the thread-local handshake. Two outcomes are possible:
a) If the handshake succeeds (no threads are found accessing the segments) the session moves to CLOSED;
b) Otherwise, the session is put back into the ALIVE state (which means that subsequent accesses will succeed again!)
This logic is problematic, as it is possible for accessing threads to observe IllegalStateException, and then to see that the scope of the accessed segment is still alive!
1. check that the session is still alive
2. put the session in the CLOSING state - from this point on, any subsequent attempt to access the segment will throw ISE (because MemorySession::checkValidState will fail - assuming they see the new value)
3. start the thread-local handshake. Two outcomes are possible:
a) If the handshake succeeds (no threads are found accessing the segments) the session moves to CLOSED;
b) Otherwise, the session is put back into the ALIVE state (which means that subsequent accesses will succeed again!)
This logic is problematic, as it is possible for accessing threads to observe IllegalStateException, and then to see that the scope of the accessed segment is still alive!
- duplicates
-
JDK-8310644 Make panama memory segment close use async handshakes
-
- Resolved
-