In _execute_stmt, this code gets hit when I do a Ctrl-C during planning (i.e. when the query is blocked), and causes the current session to be closed and reopened (you can tell because a) the session IDs change and b) the query will get cancelled with "SESSION CLOSED" as the reason). The session should stay open so we don't cause audit / auth etc. events as the result of a ctrl-C.
It might be that this is easy to hit during planning as the query blocks with its lock and that the race could happen in any case.