You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a1dce6e
Browse filesBrowse the repository at this point in the historyBrowse files
[CHORE] Say what the code does, and let the cases outlive what talks to them
A pass over the things this project's reviews ask for every time.
Comments describing how the code got here rather than what it is. Three of
them: the stale queue check explaining what an earlier version of itself did,
the construction result explaining what dispatching from there used to cause,
and a test comment citing the ThreadSanitizer run that made it what it is. All
three now say what the code does, and the rest is in the commit history where
it belongs.
A comment that had drifted off its class. The one describing what
MultiHandleOutcomeHandler counts had come to rest above CountingLogHandler,
which counts something else entirely. It is back where it belongs, and the peer
comment that pointed at "the case below" names the case instead, since the case
is nine hundred lines below.
The ordering that makes a queued request safe was not written down anywhere.
ScheduleAddSession inserts the id before Session::SendRequest asks for a
background thread, and the retirement check holds background_thread_m_ while it
looks for work, so a thread on its way out either sees the id and stays or has
already cleared background_thread_ and the spawn that follows makes a new one.
Queue first, spawn second, and now it says so.
Two cases had no assertion at all, leaving LeakSanitizer as the only thing that
could fail them, which also meant an injection that stopped working read as a
pass. Both now check that the handle really was queued before asking whether it
was released. The count they use is taken under session_ids_m_, which every
producer of that queue takes, unlike the retry queue which has no lock and is
not a test's to read.
And three cases declared their handler after the client. The client dispatches
terminal events from its destructor, and members go in reverse, so the handler
was already gone by the time it might be called. Nothing reached it, but that
was luck rather than design. All three declare it first now.
All 40 cases pass, and clean under AddressSanitizer with detect_leaks=1.
Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
0 commit comments