If disconnect_session_watches races with watch removal, the session
might no longer have a valid obc ref. In that case, move on to
the next obc.
Note, there is no danger of any obcs being *added* to the session
since the session/connection at this point is dead.
Signed-off-by: Samuel Just <sam.just@inktank.com>
continue;
}
service.watch_lock.Lock();
+
+ if (!session->watches.count((void*)obc)) {
+ // Raced with watch removal, obc is invalid
+ service.watch_lock.Unlock();
+ pg->unlock();
+ continue;
+ }
+
/* NOTE! fix this one, should be able to just lookup entity name,
however, we currently only keep EntityName on the session and not
entity_name_t. */