Comments (4)
For efficiency in the typical use case, perhaps we could only SHOW VARIABLES
once a SQL statement larger than 4MB (the MySQL Server default) has been prepared in the client?
from mysqlconnector.
What about cases where the client has upped it's max_allowed_packet
size before sending a large packet, but after we theoretically record max_allowed_packet
? We would reject a query client-side that would have succeeded.
mysql> SELECT @@global.max_allowed_packet;
+-----------------------------+
| @@global.max_allowed_packet |
+-----------------------------+
| 4194304 |
+-----------------------------+
1 row in set (0.00 sec)
mysql> SET @@global.max_allowed_packet = 8388608;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT @@global.max_allowed_packet;
+-----------------------------+
| @@global.max_allowed_packet |
+-----------------------------+
| 8388608 |
+-----------------------------+
1 row in set (0.00 sec)
Maybe a better approach is to record number of bytes sent in the packet, and throw an Outer Exception if packet size was > 4MB with "Exception after submitting XXMB Packet, ensure max_allowed_packet
is greater than XXMB" -> Inner Exception (original exception)
from mysqlconnector.
MySQL Server does send a final packet with the contents #08S01
, Got a packet bigger than 'max_allowed_packet' bytes
but then it immediately resets the socket. As a result, our library throws a SocketException
("An existing connection was forcibly closed by the remote host" or "An established connection was aborted by the software in your host machine") when trying to read that packet in:
System.dll!System.Net.Sockets.Socket.Receive(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags) Unknown
MySqlConnector.dll!MySql.Data.Protocol.Serialization.SocketByteHandler.ReadBytesAsync(System.ArraySegment<byte> buffer, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 24 C#
MySqlConnector.dll!MySql.Data.Protocol.Serialization.BufferedByteReader.ReadBytesAsync(MySql.Data.Protocol.Serialization.IByteHandler byteHandler, System.ArraySegment<byte> buffer, int count, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 34 C#
MySqlConnector.dll!MySql.Data.Protocol.Serialization.BufferedByteReader.ReadBytesAsync(MySql.Data.Protocol.Serialization.IByteHandler byteHandler, int count, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 29 C#
MySqlConnector.dll!MySql.Data.Protocol.Serialization.ProtocolUtility.ReadPacketAsync(MySql.Data.Protocol.Serialization.BufferedByteReader bufferedByteReader, MySql.Data.Protocol.Serialization.IByteHandler byteHandler, System.Func<int?> getNextSequenceNumber, MySql.Data.Protocol.Serialization.ProtocolErrorBehavior protocolErrorBehavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 13 C#
MySqlConnector.dll!MySql.Data.Protocol.Serialization.ProtocolUtility.ReadPayloadAsync(MySql.Data.Protocol.Serialization.BufferedByteReader bufferedByteReader, MySql.Data.Protocol.Serialization.IByteHandler byteHandler, System.Func<int?> getNextSequenceNumber, System.ArraySegment<byte> previousPayloads, MySql.Data.Protocol.Serialization.ProtocolErrorBehavior protocolErrorBehavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 53 C#
MySqlConnector.dll!MySql.Data.Protocol.Serialization.StandardPayloadHandler.ReadPayloadAsync(MySql.Data.Protocol.Serialization.ProtocolErrorBehavior protocolErrorBehavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior) Line 31 C#
MySqlConnector.dll!MySql.Data.Serialization.MySqlSession.TryAsync(System.Func<MySql.Data.Protocol.Serialization.ProtocolErrorBehavior, MySql.Data.Protocol.Serialization.IOBehavior, System.Threading.Tasks.ValueTask<System.ArraySegment<byte>>> func, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 471 C#
MySqlConnector.dll!MySql.Data.Serialization.MySqlSession.ReceiveReplyAsync(MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 187 C#
MySqlConnector.dll!MySql.Data.MySqlClient.Results.ResultSet.ReadResultSetHeaderAsync(MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 37 C#
MySqlConnector.dll!MySql.Data.MySqlClient.MySqlDataReader.ReadFirstResultSetAsync(MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 239 C#
MySqlConnector.dll!MySql.Data.MySqlClient.MySqlDataReader.CreateAsync(MySql.Data.MySqlClient.MySqlCommand command, System.Data.CommandBehavior behavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 227 C#
MySqlConnector.dll!MySql.Data.MySqlClient.CommandExecutors.TextCommandExecutor.ExecuteReaderAsync(string commandText, MySql.Data.MySqlClient.MySqlParameterCollection parameterCollection, System.Data.CommandBehavior behavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 59 C#
MySqlConnector.dll!MySql.Data.MySqlClient.MySqlCommand.ExecuteReaderAsync(System.Data.CommandBehavior behavior, MySql.Data.Protocol.Serialization.IOBehavior ioBehavior, System.Threading.CancellationToken cancellationToken) Line 143 C#
MySqlConnector.dll!MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(System.Data.CommandBehavior behavior) Line 116 C#
System.Data.dll!System.Data.Common.DbCommand.ExecuteReader() Unknown
from mysqlconnector.
Fixed in 0.16.1.
from mysqlconnector.
Related Issues (20)
- Using TransactionScope with UseXATransactions=False HOT 3
- Missing certificate causes `The collection already contains item with same key 'net.transport'` exception HOT 1
- Get error "Packet received out-of-order. Expected 1; got 2." when connecting to MySQL Innodb Cluster via MySQL Router HOT 1
- Authentication failed because the remote party sent a TLS alert: 'ProtocolVersion' HOT 15
- Remove TLS version fallback code HOT 2
- Request to support config LoggerFactory without using MySqlDataSource HOT 4
- Add logging for transaction start, commit, roll back HOT 8
- ip address can not work with version: 2.3.1 and dotnet 8
- Stored Procedure with where clause that contains a white space is not retrieving data when called from .netcore HOT 2
- When the .exe file name is changed, the .exe.config file name must be changed accordingly HOT 2
- session_connect_attrs not being set on MariaDB HOT 2
- Question: Expected m_hasMoreResults to be false HOT 2
- Application Crash When Connecting to MySQL Server After Upgrading to MySqlConnector 8.1/8.2 HOT 2
- System.ArgumentOutOfRangeException: delay ('-14') must be a non-negative value. (Parameter 'delay') HOT 2
- System.InvalidProgramException in Container-Environment HOT 3
- SSL Authentication Error HOT 1
- Sometimes: Object Null Exception when using var rdr = await cmd.ExecuteReaderAsync(); HOT 1
- OpenAsync improperly setting SynchronizationContext HOT 14
- Is it fully compatible with Apache Doris?
- InvalidCastException when using StoredProcedure with MySQL 5.0 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysqlconnector.