viper-framework/viper

Viper with backend PostgreSQL exhausts connections

Open

#583 opened on 2017年6月6日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)Python (1,527 stars) (372 forks)batch import
bug (to verify)help wanted

説明

When I run viper in API mode I start https://github.com/phage-nz/ph0neutria/ to give me some fresh new samples. I can let this run for a while until all my PostgreSQL connection slots are exhausted (in my case 100).

    Base.metadata.create_all(self.engine)
  File "build/bdist.system/egg/sqlalchemy/sql/schema.py", line 3885, in create_all
    tables=tables)
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 1928, in _run_visitor
    with self._optional_conn_ctx_manager(connection) as conn:
  File "/usr/local/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 1921, in _optional_conn_ctx_manager
    with self.contextual_connect() as conn:
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 2112, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 2151, in _wrap_pool_connect
    e, dialect, self)
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 1465, in _handle_dbapi_exception_noconnection
    exc_info
  File "build/bdist.system/egg/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "build/bdist.system/egg/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect
    return fn()
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 387, in connect
    return _ConnectionFairy._checkout(self)
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 766, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 516, in checkout
    rec = pool._do_get()
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 1138, in _do_get
    self._dec_overflow()
  File "build/bdist.system/egg/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 1135, in _do_get
    return self._create_connection()
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 333, in _create_connection
    return _ConnectionRecord(self)
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 461, in __init__
    self.__connect(first_connect_check=True)
  File "build/bdist.system/egg/sqlalchemy/pool.py", line 651, in __connect
    connection = pool._invoke_creator(self)
  File "build/bdist.system/egg/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "build/bdist.system/egg/sqlalchemy/engine/default.py", line 393, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: (psycopg2.OperationalError) FATAL:  remaining connection slots are reserved for non-replication superuser connections

My assumption is that some close connections are missing in the code (or not working properly for PostgreSQL)

コントリビューターガイド