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
Broken pipe for large blobs #397
Comments
Is there any logs in mysql.err log? |
No, nothing. Neither in the |
"Broken Pipe" means TCP connection has been broken. Could you create a script to reproduce your problem? |
Sure, here's the script to reproduce my problem. Uncompressed, the numpy array should be about 30M large. It is a bit, but it is not that large. import pymysql as client
import binascii
import zlib
import numpy as np
conn_info = {'host': 'localhost',
'max_allowed_packet': 1073741824,
'passwd': '****',
'port': 3306,
'user': 'user'}
conn = client.connect(**conn_info)
with conn.cursor() as cur:
cur.execute("CREATE DATABASE IF NOT EXISTS `bigblob`")
cur.execute('CREATE TABLE IF NOT EXISTS `bigblob`.`test` (`idx` int NOT NULL, `values` longblob NOT NULL, PRIMARY KEY (`idx`)) ENGINE = InnoDB, COMMENT ""')
value = zlib.compress(np.random.randn(250*250*60))
blob = '0x' + binascii.b2a_hex(value).decode('ascii')
query = """INSERT INTO `bigblob`.`test` (`idx`,`values`) VALUES (%%s,%s)""" % (blob,)
cur.execute(query, args=(0,))
conn.commit()
conn.close() |
Check that your |
Thanks for the hint, but I don't think that is the problem. I increased my |
With pymysql 0.7.2. it works. Could you confirm that your |
When inserting a large blob (encoded as a hexadecimal string) via pymysql, I get a broken pipe error.
This is the stack trace:
I set
max_allowed_packet=1024M
for the mysql server/client andmax_allowed_packet=1024 ** 3
forpymysql
. Therefore, this cannot be the problem. Also, when I dump the query in an SQL file and pipe that into the mysql client, the insert works fine.I also read about the previous issue with broken pipe, but this seemed to apply to an older version. I have
pymysql.__version__=='0.6.7.None'
.Any idea what could cause this?
The text was updated successfully, but these errors were encountered: