Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] InterfaceError: (0, '') #277

Closed
xunto opened this issue Jul 4, 2017 · 17 comments
Closed

[BUG] InterfaceError: (0, '') #277

xunto opened this issue Jul 4, 2017 · 17 comments

Comments

@xunto
Copy link

xunto commented Jul 4, 2017

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "<string>", line 2, in application_list
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 423, in new_func
    finally: db_session.__exit__(exc_type, exc, tb)
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 397, in __exit__
    else: rollback()
  File "<string>", line 2, in rollback
  File "/usr/local/lib/python3.6/dist-packages/pony/utils/utils.py", line 58, in cut_traceback
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 326, in rollback
    transact_reraise(RollbackException, exceptions)
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 283, in transact_reraise
    reraise(exc_class, new_exc, tb)
  File "/usr/local/lib/python3.6/dist-packages/pony/utils/utils.py", line 85, in reraise
    try: raise exc.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 323, in rollback
    try: cache.rollback()
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 1559, in rollback
    cache.close(rollback=True)
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/core.py", line 1573, in close
    try: provider.rollback(connection, cache)
  File "<string>", line 2, in rollback
  File "/usr/local/lib/python3.6/dist-packages/pony/orm/dbapiprovider.py", line 59, in wrap_dbapi_exceptions
    raise InterfaceError(e)
pony.orm.core.RollbackException: InterfaceError: (0, '')

Looks like it happen when you do nothing to db for some time and then do something. For example, when script waits for http request and when it get it, pony throws the exception. If you do another request after that, everything will be ok.

I had this issue with aiohttp (but i thought that it's related to threadpool that i used) and flask.

@xunto
Copy link
Author

xunto commented Jul 4, 2017

pony version is 0.7.1

@xunto
Copy link
Author

xunto commented Jul 4, 2017

Database... I had this issue with mysql.

@Achillesxu
Copy link

i got the same error, someone find some way to solve it?

@xunto
Copy link
Author

xunto commented Jul 11, 2017

No. But I found out that it is related to mysql driver and global cursor usage.

@Achillesxu
Copy link

how to test this? i planed to switch to sqlalchemy

@Achillesxu
Copy link

incredibly, i replace the PyMySQl using the MySQL-python, the bug had gone!

@xunto
Copy link
Author

xunto commented Jul 14, 2017

@Achillesxu could you provide some code? This bug driving me crazy! Did you replace mysql driver? I didn't know there is such option. :D

@xunto
Copy link
Author

xunto commented Jul 14, 2017

I mean that I didn't know there is option to choose specific driver. What should I do? Just remove PyMySQl and install MySQL-python?

@xunto
Copy link
Author

xunto commented Jul 14, 2017

Meh, MySQL-python doesn't seem to work with python3.6. :(

@kozlovsky
Copy link
Member

Hi @xunto , I think this issue is related to #219. You can check Pony version from GitHub, the bug should be already fixed in 1146ff1. Before the fix, RollbackException masked the real problem caused by database driver, now you should be able to see the real reason for the error. I plan to make new Pony release at Monday with this fix.

@xunto
Copy link
Author

xunto commented Jul 15, 2017

@kozlovsky wow, new release is good news. I'll check today if problem is fixed on the lastest commit of the orm branch and will let you know.

@xunto
Copy link
Author

xunto commented Jul 15, 2017

pony.orm.dbapiprovider.OperationalError: (2013, 'Lost connection to MySQL server during query')

Now I caught this. Is it something with Mysql configuration or what?

@kozlovsky
Copy link
Member

I think probably so. Some of the following links may help:
r-dbi/RMySQL#190
https://stackoverflow.com/questions/6516943/lost-connection-to-mysql-server-during-query
https://serverfault.com/questions/739137/lost-connection-to-mysql-server-during-query

If you discover a reason for the issue, then please leave a comment here for other MySQL users.

@xunto
Copy link
Author

xunto commented Jul 15, 2017

Oh, that legacy. :) But it doesn't look like there are such problems with php app.

@Achillesxu
Copy link

Pony tries to use the MySQLdb driver for working with MySQL. If this module cannot be imported, Pony tries to use pymysql. See the MySQLdb and pymysql documentation for more information regarding these drivers. from 'https://docs.ponyorm.com/api_reference.html#mysql'
i just pip install MySQL-python, restart my program, and uninstall PyMySQL, my error dont occur again.
my error is that multiprocess(python 2.7 using PyMySQL driver) write records to mysql(5.5) database, then commit error occur frequently, the error is same as that you encounter.

@xunto
Copy link
Author

xunto commented Jul 17, 2017

max_connections = 400
max_allowed_packet = 1G
wait_timeout = 31536000

I'm not the one the who is administrating database but asked this man to give me that. This configuration seem to solve the problem.

@xunto
Copy link
Author

xunto commented Jul 31, 2017

I think everything is OK now. But I have more mysql related problems! I close this one for now.

@xunto xunto closed this as completed Jul 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants