SERVER-139053In Code Review

Load-shedding sweep reads another thread's QueryLifespan slot without synchronization

Item 1 of SERVER-138793. {{sweepQueuedOperationsForMemoryPressure}} ({{query_memory_load_shedding.cpp:475}}) runs on the monitor thread. For each client it takes the {{ClientLock}}, then calls {{QueryLifespan::getIfExists(opCtx)}} (line 504) and {{getOpState(opCtx)}} (line 507). Both read the lifespan slot, a plain {{std::shared_ptr}} decoration on the {{OperationContext}}. The op's own thread writes that slot without the {{ClientLock}}: {{QueryLifespan::get()}} (lazy create), {{bind()}}, and t

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc1026
Components
Server components related to this issue

No components specified.

Labels
Tags and classification

No labels assigned.