Bug #11237 useCompression=true and LOAD DATA LOCAL INFILE SQL Command
Submitted: 10 Jun 2005 11:44 Modified: 22 Jan 2013 23:11
Reporter: Jürgen Rohrbach Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.x, 3.2.x OS:MacOS (Mac OS X Panther)
Assigned to: Alexander Soklakov CPU Architecture:Any

[10 Jun 2005 11:44] Jürgen Rohrbach
Description:
when i use the mysql jdbc connector and use the property 
useCompression=true to compress the datastream,
i get a java.net.SocketException.
the used SQL-Command is: "LOAD DATA LOCAL INFILE ...". 
i connect from a local client to a remote server.

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: 

** BEGIN NESTED EXCEPTION ** 

java.net.SocketException
MESSAGE: Broken pipe

STACKTRACE:

java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
        at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2614)
        at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2547)
        at com.mysql.jdbc.MysqlIO.sendFileToServer(MysqlIO.java:2714)
        at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1897)
        at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1347)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1667)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2379)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2306)
        at com.mysql.jdbc.Statement.execute(Statement.java:911)
		...

** END NESTED EXCEPTION **

        at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2634)
        at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2547)
        at com.mysql.jdbc.MysqlIO.sendFileToServer(MysqlIO.java:2714)
        at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1897)
        at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1347)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1667)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2379)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2306)
        at com.mysql.jdbc.Statement.execute(Statement.java:911)
		...

How to repeat:
just use the load data local infile sql command to a remote server.
all works fine when the compression is turned off. but the compression is needed because of bandwidth limitations.
[15 Jun 2005 7:42] Vasily Kishkin
I was not able to reproduce the bug and I need your test case. Could you please write here the test case ?
[15 Jul 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[4 Feb 2008 9:31] Damien Gerard
I got the same problem with c# connector. 
Use Compression and LOAD DATA LOCAL with huge file (~300Mo) cause a socket Exception error.

Here a simple test case:

<code>
MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "Server=xxx; Username=xx; Password=xx; database=xx; Port=3306;";
conn.UseCompression = true;
conn.Open();
String myInsertQuery = "LOAD DATA LOCAL INFILE 'Data/hugefile.txt' REPLACE INTO TABLE `" + tablename + "` FIELDS TERMINATED BY '|' ENCLOSED BY '' LINES TERMINATED BY '" + Environment.NewLine + "'";
MySqlCommand myCommand = new MySqlCommand(myInsertQuery, conn);
myCommand.ExecuteNonQuery();
conn.Close();
</code>

When deactivate UseCompression everything works fine.
[11 Oct 2012 14:35] philippe Bar
I have the same problem with Connector/J 5.1.18 - OS: Windows XP
[19 Nov 2012 13:23] Alexander Soklakov
Hi Philippe,

Thanks for refresh of this bug report. We plan to repair compression protocol implementation in next c/J release.
[20 Nov 2012 8:15] Alexander Soklakov
Bug#67453 is duplicate of this one.
[22 Jan 2013 23:11] John Russell
Added to changelog for 5.1.23: 

With the connection setting useCompression=true, the SQL statement
LOAD DATA LOCAL INFILE could cause a java.net.SocketException error
due to a broken pipe.