esnme / ultramysql

A fast MySQL driver written in pure C/C++ for Python. Compatible with gevent through monkey patching.
http://www.esn.me
Other
547 stars 95 forks source link

Connection reset by peer when receiving #20

Closed ericyue closed 11 years ago

ericyue commented 12 years ago

cnn.connect ('a internal ip address which running mysql (some old version)', 3306,'user','pwd', "bugzilla") cnn.query("show tables") Traceback (most recent call last): File "", line 1, in umysql.Error: (0, 'Connection reset by peer when receiving')

sometimes show :

cnn.query("select count(*) from bugs") Traceback (most recent call last): File "", line 1, in umysql.SQLError: (1043, 'Bad handshake')

ericyue commented 12 years ago

add:
SHOW VARIABLES LIKE 'old_passwords' result is ON

how to solve this problem (i donnt have the permisson to modify the mysql server )

ivanjr0 commented 12 years ago

I'm dealing exactly with the same problem. Anyone can give some information about it? I can't modify the server as well.

>>> import umysql
>>> c = umysql.Connection()
>>> c.connect(host, port, user, password, db)

>>> c.query('SELECT 1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
umysql.Error: (0, 'Connection reset by peer when receiving')

>>> c.close()
>>> c.connect(host, port, user, password, db)
>>> c.query('SELECT 1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
umysql.SQLError: (1043, 'Bad handshake')
jskorpan commented 12 years ago

Can't reproduce, please provide a repro if you want me to have a look at this

echocolate commented 11 years ago

any answers for this issue?

jskorpan commented 11 years ago

As stated earlier, the issue can't be reproduced.

Using head revision and Python on Win32 and MySQL server 5.5 I get the expected behavior: Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import umysql c = umysql.Connection() c.connect("127.0.0.1", 3306, "XXX", "XXX", "test") c.query("SELECT 1") <umysql.ResultSet object at 0x01C8F2D8>

What server/OS/setup are you on?

LeeXiaolan commented 11 years ago

The problem is located. See https://github.com/LeeXiaolan/ultramysql/commit/fdb8b3147ef8b928bccfad33021297f11b3e157e

V-E-O commented 11 years ago

This issue still happens when connection lost or closed long time not-alive, even is_connected tested True, then any query could lead this error.

Anuradha-26 commented 7 years ago

I get the same error (0, 'Connection reset by peer when receiving') with mysql server occasionally when executing "roll back" query. What is the cause of such error? Is the connection to the server timing out?