Bug #83330 | MySqlException (EndOfStreamException) inserting large blob with UseCompression | ||
---|---|---|---|
Submitted: | 11 Oct 2016 4:58 | Modified: | 7 Apr 2020 16:19 |
Reporter: | Bradley Grainger (OCA) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.9.9, 7.0.5 | OS: | Windows (10.0.14393 x64) |
Assigned to: | CPU Architecture: | Any |
[11 Oct 2016 4:58]
Bradley Grainger
[11 Oct 2016 5:18]
Bradley Grainger
With a buffer size of 16MiB (`var bytes = new byte[16777216];`) I can get the following exception: MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at MySql.Data.Common.MyNetworkStream.HandleOrRethrowException(Exception e) at MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.CompressedStream.PrepareNextPacket() at MySql.Data.MySqlClient.CompressedStream.Read(Byte[] buffer, Int32 offset, Int32 count) at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.LoadPacket() at MySql.Data.MySqlClient.MySqlStream.LoadPacket() at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at MySqlCompressBlob.Program.Main(String[] args) in Program.cs:line 33
[11 Oct 2016 5:24]
Bradley Grainger
With a buffer of `new byte[16748422]` (in the preceding code sample), I can sometimes reproduce the following exception (infrequently) as well as the other two exceptions. It doesn't seem to be predictable: running a new instance of a console app may throw any one of the three exceptions given so far in this bug. MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at MySql.Data.Common.MyNetworkStream.HandleOrRethrowException(Exception e) at MySql.Data.Common.MyNetworkStream.Write(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.TimedStream.Write(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.CompressedStream.CompressAndSendCache() at MySql.Data.MySqlClient.CompressedStream.Flush() at MySql.Data.MySqlClient.MySqlStream.SendPacket(MySqlPacket packet) at MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySqlPacket packetToExecute) at MySql.Data.MySqlClient.NativeDriver.SendQuery(MySqlPacket queryPacket) at MySql.Data.MySqlClient.Driver.SendQuery(MySqlPacket p) at MySql.Data.MySqlClient.Statement.ExecuteNext() at MySql.Data.MySqlClient.PreparableStatement.ExecuteNext() at MySql.Data.MySqlClient.PreparableStatement.Execute() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at MySqlCompressBlob.Program.Main(String[] args) in Program.cs:line 33
[12 Oct 2016 9:43]
Chiranjeevi Battula
Hello Bradley Grainger, Thank you for the bug report and test case. Verified this behavior on Visual Studio 2013 (C#.Net) and Connector/NET 6.9.9 version. Thanks, Chiranjeevi.
[12 Oct 2016 9:44]
Chiranjeevi Battula
Screenshot
Attachment: 83330.JPG (image/jpeg, text), 212.84 KiB.
[7 Apr 2020 16:19]
Daniel Valdez
Posted by developer: This test was done using all the specified versions and the mentioned error didn't came up, instead of that, we received the following exception: MySql.Data.MySqlClient.MySqlException: 'Packets larger than max_allowed_packet are not allowed.' Which is properly triggered, only when we modify the value of the variable max_allowed_packet to be higher than the value to be inserted the test works fine, the blob value is properly inserted in the database. Regards