Skip to content
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

System.ArgumentOutOfRangeException: delay ('-14') must be a non-negative value. (Parameter 'delay') #1424

Closed
DmitryMak opened this issue Dec 27, 2023 · 2 comments
Assignees
Labels

Comments

@DmitryMak
Copy link

DmitryMak commented Dec 27, 2023

Software versions
MySqlConnector version: 2.3.3
MySQL 8
.NET version: .net 8
ORM NuGet packages and versions: nhibernate latest

Describe the bug
Sporadic ArgumentOutOfRange exception

Exception

---> System.ArgumentOutOfRangeException: delay ('-14') must be a non-negative value. (Parameter 'delay')
Actual value was -14.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at MySqlConnector.Utilities.TimerQueue.Add(Int32 delay, Action action) in src/MySqlConnector/Utilities/TimerQueue.cs:line 18
at MySqlConnector.Protocol.Serialization.StreamByteHandler.<ReadBytesAsync>g__DoReadBytesAsync|6_2(Memory1 buffer) in src/MySqlConnector/Protocol/Serialization/StreamByteHandler.cs:line 62
at MySqlConnector.Protocol.Serialization.BufferedByteReader.ReadBytesAsync(IByteHandler byteHandler, ArraySegment1 buffer, Int32 totalBytesToRead, IOBehavior ioBehavior) in src/MySqlConnector/Protocol/Serialization/BufferedByteReader.cs:line 34
at MySqlConnector.Protocol.Serialization.ProtocolUtility.ReadPayloadAsync(BufferedByteReader bufferedByteReader, IByteHandler byteHandler, Func1 getNextSequenceNumber, ArraySegmentHolder1 previousPayloads, ProtocolErrorBehavior protocolErrorBehavior, IOBehavior ioBehavior) in src/MySqlConnector/Protocol/Serialization/ProtocolUtility.cs:line 421
at MySqlConnector.Core.ServerSession.ReceiveReplyAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/Core/ServerSession.cs:line 935
at MySqlConnector.Core.ServerSession.TryResetConnectionAsync(ConnectionSettings cs, MySqlConnection connection, IOBehavior ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/Core/ServerSession.cs:line 648
at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/Core/ConnectionPool.cs:line 76
at MySqlConnector.Core.ConnectionPool.GetSessionAsync(MySqlConnection connection, Int64 startingTimestamp, Int32 timeoutMilliseconds, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/Core/ConnectionPool.cs:line 146
at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int64 startingTimestamp, Activity activity, Nullable1 ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/MySqlConnection.cs:line 919
at MySqlConnector.MySqlConnection.OpenAsync(Nullable1 ioBehavior, CancellationToken cancellationToken) in src/MySqlConnector/MySqlConnection.cs:line 419
at NHibernate.Connection.DriverConnectionProvider.GetConnectionAsync(String connectionString, CancellationToken cancellationToken)

Expected behavior
No exception because Argument** exception from deep within a library usually indicate a bug

@bgrainger bgrainger added the bug label Dec 28, 2023
@bgrainger
Copy link
Member

It looks like a fix for a similar issue was applied to SocketByteHandler but not StreamByteHandler: #447. (Given that this was fixed for the other class so long ago, it's odd that it hasn't been reported here before.)

@bgrainger bgrainger self-assigned this Dec 29, 2023
@bgrainger
Copy link
Member

Fixed in 2.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants