Seite 1 von 1

Sqlalchemy pg8000 timeout

Verfasst: Montag 28. Januar 2013, 16:52
von Ruffy
Hi,

Ich hab seit neustem das problem dass immer häufiger eine "timeout: timed out" Fehlermeldung/exception kommt wenn ich versuche auf die pgsql DB zuzugreifen.

Gibts irgendwie ne möglichkeit das zu verhindern? Ich bin mir nicht ganz sicher woher das kommt, aber würde sich das nicht verhindern lassen indem sqlalchemy einfach eine neue verbindung öffnet und diese benutzt?

anbei die Fehlermeldung:

Code: Alles auswählen

Traceback (most recent call last):
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/apscheduler/scheduler.py", line 477, in _run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/synodlnatrakt/main.py", line 90, in import_mediaserver
    for result in dbresult:
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/orm/query.py", line 2176, in __iter__
    return self._execute_and_instances(context)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/orm/query.py", line 2191, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/engine/base.py", line 1450, in execute
    params)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/engine/base.py", line 1583, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/engine/base.py", line 1690, in _execute_context
    context)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/sqlalchemy/engine/default.py", line 335, in do_execute
    cursor.execute(statement, parameters)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/dbapi.py", line 243, in _fn
    return fn(self, *args, **kwargs)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/dbapi.py", line 314, in execute
    self._execute(operation, args)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/dbapi.py", line 325, in _execute
    self._connection.rollback()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/dbapi.py", line 452, in _fn
    return fn(self, *args, **kwargs)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/dbapi.py", line 529, in rollback
    self.conn.rollback()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/interface.py", line 515, in rollback
    self._rollback.execute()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/interface.py", line 139, in execute
    self._row_desc, cmd = self.c.bind(self._portal_name, self._statement_name, args, self._parse_row_desc, kwargs.get("stream"))
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/protocol.py", line 915, in _fn
    self._sync()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/protocol.py", line 1208, in _sync
    reader.handle_messages()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/protocol.py", line 876, in handle_messages
    msg = self._conn._read_message()
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/protocol.py", line 1000, in _read_message
    bytes = self._read_bytes(5)
  File "/Users/workstation/Documents/github/SynoDLNAtrakt/lib/pg8000/protocol.py", line 988, in _read_bytes
    self._sock_buf = self._sock.recv(1024)
timeout: timed out

Re: Sqlalchemy pg8000 timeout

Verfasst: Dienstag 29. Januar 2013, 12:09
von noisefloor
Hallo,
aber würde sich das nicht verhindern lassen indem sqlalchemy einfach eine neue verbindung öffnet und diese benutzt?
SA benutzt standardmäßig "connection pooling", d.h. es verwaltet eigenständig einen Verbindungspool. Wenn du das nicht explizit geändert / überschrieben hast, dann liegt es nicht daran.

Kommt der timeout schon bei der 1. DB Verbindung oder erst, wenn du X Abfragen mit der DB gemacht hast?

Gruß, noisefloor