This is the spin-off of #126. When running the following code and restarting the server in the middle, the following exception was raised:
ERROR:tornado.application:Exception in callback (6, <function null_wrapper at 0x7ff9431391b8>)
Traceback (most recent call last):
File ".../local/lib/python2.7/site-packages/tornado/ioloop.py", line 866, in start
handler_func(fd_obj, events)
File ".../local/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File ".../momoko/connection.py", line 713, in _io_callback
self.ioloop.update_handler(self.fileno, IOLoop.WRITE)
File ".../local/lib/python2.7/site-packages/tornado/ioloop.py", line 708, in update_handler
self._impl.modify(fd, events | self.ERROR)
IOError: [Errno 2] No such file or directory
The code that reproduces the issue:
from tornado.ioloop import IOLoop
import momoko
from tornado.gen import engine
if __name__ == '__main__':
ioloop = IOLoop.instance()
db = momoko.Pool(
dsn='dbname=your_db user=your_user password=very_secret_password '
'host=remote_host port=5432',
size=1,
ioloop=ioloop,
)
future = db.connect()
ioloop.add_future(future, lambda f: ioloop.stop())
ioloop.start()
future.result()
@engine
def never_ending_db_query_loop(callback):
while True:
try:
cursor = yield db.execute('SELECT 1')
row = cursor.fetchone()
print 'db returned: {0}'.format(row[0])
except Exception as e:
print e
callback()
never_ending_db_query_loop(ioloop.stop)
ioloop.start()
This is the spin-off of #126. When running the following code and restarting the server in the middle, the following exception was raised:
The code that reproduces the issue: