class UpdatesJob include SuckerPunch::Job def perform SecondDB::Base.connection_pool.with_connection do |conn| pgconn = conn.raw_connection pgconn.async_exec 'LISTEN events' begin loop do pgconn.wait_for_notify do |channel, pid, json| logger.warn('event') end end rescue Exception => e logger.warn('loop exception %s' % e.message) else logger.warn('loop exit without exception') ensure logger.warn('ensure UNLISTEN') pgconn.async_exec 'UNLISTEN events' end end end end
I have an UpdateJob.perform_async
in a initialiser.
The behaviour under passenger is the following
event ... event,
ensure UNLISTEN
About 12 events, 5 minutes, then an exception which is swallowed by the with_connection
wrapper and drops me into the ensure
. Removing the with_connection
allows me to catch the exception, SSL corrupt response mac or some such, turn off SSL, server closed connection.
I have no idea what is going on here, this is on real hardware, not Heroku, Debian stable but repeatable on my Ubuntu laptop.
Any idea what would be happening here?
Thanks in advance!