The main loop of the job runner waits for NOTIFY events via a select() call, with a 60 seconds timeout.
If there are no activity in the queue_job table it seems that tcp keepalives are not sent (in that very specific scenario), causing some intermediaries (such as haproxy) to close the connection, making the jobrunner to restart on a socket error, in turn triggering #245.
A solution (to be tested) is to insert a conn.execute("SELECT 1") around here.