I’m seeing the following error on a pretty regular basis. Based on what I’m reading in the peewee
docs it looks like the connection is timing out and this is not being properly handled by prodigy. To reproduce all I need to do is start the app (in this case I’m using the textcat.teach
example) and leave it alone for a while. Then when I come back and try to save some answers I get this error. The only way to fix the app once this happens is to restart it completely. I’m using the PyMySQL
driver. Thanks!
16:02:04 - CONTROLLER: Receiving 3 answers
16:02:05 - PROGRESS: Estimating progress of 0.1667
16:02:05 - Exception when serving /give_answers
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1043, in _write_bytes
self._sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3830, in execute_sql
cursor.execute(sql, params or ())
File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 165, in execute
result = self._query(query)
File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 321, in _query
conn.query(q)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 859, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1096, in _execute_command
self._write_bytes(packet)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1048, in _write_bytes
"MySQL server has gone away (%r)" % (e,))
pymysql.err.OperationalError: (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "cython_src/prodigy/components/db.pyx", line 191, in prodigy.components.db.Database.add_examples
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 4977, in create
inst.save(force_insert=True)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 5170, in save
pk_from_cursor = self.insert(**field_dict).execute()
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3584, in execute
cursor = self._execute()
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 2939, in _execute
return self.database.execute_sql(sql, params, self.require_commit)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3837, in execute_sql
self.commit()
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3656, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 135, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3830, in execute_sql
cursor.execute(sql, params or ())
File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 165, in execute
result = self._query(query)
File "/usr/local/lib/python3.6/site-packages/pymysql/cursors.py", line 321, in _query
conn.query(q)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 859, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1096, in _execute_command
self._write_bytes(packet)
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1048, in _write_bytes
"MySQL server has gone away (%r)" % (e,))
peewee.OperationalError: (2006, "MySQL server has gone away (BrokenPipeError(32, 'Broken pipe'))")
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3849, in rollback
self.get_conn().rollback()
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 785, in rollback
self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in _execute_command
raise err.InterfaceError("(0, '')")
pymysql.err.InterfaceError: (0, '')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/waitress/channel.py", line 338, in service
task.service()
File "/usr/local/lib/python3.6/site-packages/waitress/task.py", line 169, in service
self.execute()
File "/usr/local/lib/python3.6/site-packages/waitress/task.py", line 399, in execute
app_iter = self.channel.server.application(env, start_response)
File "/usr/local/lib/python3.6/site-packages/hug/api.py", line 424, in api_auto_instantiate
return module.__hug_wsgi__(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/falcon/api.py", line 244, in __call__
responder(req, resp, **params)
File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 734, in __call__
raise exception
File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 709, in __call__
self.render_content(self.call_function(input_parameters), request, response, **kwargs)
File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 649, in call_function
return self.interface(**parameters)
File "/usr/local/lib/python3.6/site-packages/hug/interface.py", line 100, in __call__
return __hug_internal_self._function(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/prodigy/app.py", line 71, in give_answers
controller.receive_answers(answers)
File "cython_src/prodigy/core.pyx", line 104, in prodigy.core.Controller.receive_answers
File "cython_src/prodigy/components/db.pyx", line 188, in prodigy.components.db.Database.add_examples
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 4452, in __exit__
return self.context_manager.__exit__(exc_type, exc_val, exc_tb)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 4484, in __exit__
self.rollback(False)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 4471, in rollback
self.db.rollback()
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3849, in rollback
self.get_conn().rollback()
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3656, in __exit__
reraise(new_type, new_type(*exc_args), traceback)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 135, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3849, in rollback
self.get_conn().rollback()
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 785, in rollback
self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
File "/usr/local/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in _execute_command
raise err.InterfaceError("(0, '')")
peewee.InterfaceError: (0, '')