Skip to content

synchronize bot session should not close re-assigned sessions

Cal Pratt requested to merge cpratt34/safely-ignore-bot-mismatch into master

In some cases the bot name in the database doesn't match a name in the session. This case happens when a new bot session is created while an older session for a bot id is waiting on leases. This can happen when a worker reboots but the connection context takes a long time to close. The old request is waiting on the job assigner before going into sync leases. In this case, we DO NOT want to update anything in the database. The work/lease has already been re-assigned to a new session. Closing anything in the database at this point would cause the newly restarted worker to get cancelled prematurely.

This is different than the case where there are multiple bot sessions in the database. That behavior is still very unexpected, and should not be possible to enter. In those cases, close out all of the sessions, as there's no way to determine which bot session should be the real owner of the bot id.

Also added more detailed logs in some places.

Edited by Cal Pratt

Merge request reports