-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Joker - StorEng - 2023-10-17
-
0
/*
* No lock is required because the session array is fixed size, but it may contain inactive
* entries. We must review any active session, so insert a read barrier after reading the active
* session count. That way, no matter what sessions come or go, we'll check the slots for all of
* the sessions that could have been active when we started our check.
*/
WT_ORDERED_READ(session_cnt, conn->session_cnt);
/*
* We need to order the read of the connection generation before the read of the session
* generation. If the session generation read is ordered before the connection generation read
* it could read an earlier session generation value. This would then violate the acquisition
* semantics and could result in us reading 0 for the session generation when it is non-zero.
*/
WT_ORDERED_READ(oldest, conn->generations[which]);
In __gen_oldest, we read the session count before the global generation. This may create a problem if we race with a thread opening a new session and getting a generation.
Here's the sequence that it is wrong:
- thread A reads the session count
- thread B opens a session and increase the session count
- thread B enters a generation with global generation at 10
- thread C increases the global generation to 11
- thread A reads the global generation as 11
- thread A misses the session generation of thread B because it doesn't read its session at all.
To fix this, we should ensure the global generation is read before we read the session count.
- duplicates
-
WT-11217 Review the session array maintenance and state tracking in WiredTiger
-
- Closed
-