Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Restarting Postgress server during high load cases uncaught exception momoko #127

Closed
haizaar opened this issue Oct 25, 2015 · 0 comments
Closed

Comments

@haizaar
Copy link
Collaborator

haizaar commented Oct 25, 2015

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()
haizaar added a commit that referenced this issue Oct 26, 2015
friedcell added a commit to friedcell/momoko that referenced this issue Jul 13, 2023
* commit 'ff4b2189f3a9f6127167678204f58a42cf93a9d7':
  Going 2.2.2
  PEP8 fix
  Catching all syncronous errors. Fixes FSX#134.
  Prevening tornado from logging (falsy) errors
  Update README.rst
  Fix spelling error (renames an instance attr).
  Fix another docstring typo.
  Grammar/typo fixes in a docstring.
  docs: clarify an ambiguous paragraph
  Catching IOError. Fixes FSX#127
  Fix typo in readme.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant