For a new application, i have installed web2py 2.16.1 under python 3.6 and 
using psycopg2 2.7.4 for postgresql access.

Everything is working okay, except the web2py scheduler.

After successfull execution of the first task, the scheduler gives an error 
in the send_heartbeat function.
The task output is correctly stored in the database, with status COMPLETED. 
The transaction is committed.

But then in the first heartbeat after completion, the  error below is 
thrown:

Looks like the database connection is lost unexpected.

The strange thing is that this is only happening with psycopg2. When the 
PG8000 connector is used, everything is working fine.
I have tested this on my development system (MacBook)

On my production system under Ubuntu 16.04, the same thing is happening. 

Does anyone have a clue?

The error:

ERROR:web2py.scheduler.MyMac.local#21060:Error retrieving status
Exception in thread Thread-30:
Traceback (most recent call last):
  File "/Users/me/PycharmProjects/myapp/web2py/gluon/scheduler.py", line 
1168, in send_heartbeat
    mybackedstatus = db(sw.worker_name == self.worker_name).select().first()
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/objects.py",
 
line 2250, in select
    return adapter.select(self.query, fields, attributes)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 762, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 718, in _select_aux
    rows = self._select_aux_execute(sql)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 712, in _select_aux_execute
    self.execute(sql)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/__init__.py",
 
line 67, in wrap
    return f(*args, **kwargs)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 412, in execute
    rv = self.cursor.execute(command, *args[1:], **kwargs)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File 
"/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py",
 
line 916, in _bootstrap_inner
    self.run()
  File "/Users/me/PycharmProjects/myapp/web2py/gluon/scheduler.py", line 
637, in run
    self.send_heartbeat(counter)
  File "/Users/me/PycharmProjects/myapp/web2py/gluon/scheduler.py", line 
1239, in send_heartbeat
    db.rollback()
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/base.py",
 
line 704, in rollback
    self._adapter.rollback()
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/__init__.py",
 
line 56, in wrap
    return f(*args, **kwargs)
  File 
"/Users/me/PycharmProjects/myapp/venv/lib/python3.6/site-packages/pydal/adapters/base.py",
 
line 865, in rollback
    return self.connection.rollback()
psycopg2.InterfaceError: connection already closed

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to