TestParallelWrites failing
See original GitHub issue@JanEggers I saw that the Unit Test “TestParallelWrites” fails from time to time when being executed 20 times in a row (sometimes more sometimes less). I don’t think that it is related to my latest change (replacing the semaphore with async lock).
The errors usually indicate that the buffer length management is broken.
TestParallelWrites
Source: MqttConnectionContextTest.cs line 40
Duration: 87 ms
Message:
Test method MQTTnet.AspNetCore.Tests.MqttConnectionContextTest.TestParallelWrites threw exception:
System.ArgumentOutOfRangeException: Number was less than the array's lower bound in the first dimension. (Parameter 'destinationIndex')
Stack Trace:
Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
MqttPacketWriter.Write(Byte[] buffer, Int32 offset, Int32 count) line 140
MqttPacketWriter.Write(ArraySegment`1 buffer) line 196
MqttPacketWriter.WriteVariableLengthInteger(UInt32 value) line 82
MqttV310PacketFormatter.Encode(MqttBasePacket packet) line 47
MqttPacketFormatterAdapter.Encode(MqttBasePacket packet) line 51
MqttConnectionContext.SendPacketAsync(MqttBasePacket packet, TimeSpan timeout, CancellationToken cancellationToken) line 166
<<TestParallelWrites>b__1>d.MoveNext() line 52
--- End of stack trace from previous location where exception was thrown ---
MqttConnectionContextTest.TestParallelWrites() line 56
ThreadOperations.ExecuteWithAbortSafety(Action action)
Do you have any idea what is wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
TestNG parallel tests failing
My understanding is, while setUp() method is being run on a thread, some other tests on different threads are trying to access the...
Read more >[BUG] Failing or flaky tests when run in parallel #12827
Parallel test execution puts more stress on your system and flaky tests are more likely to fail. You should address the flakiness and...
Read more >Fast, Parallel Database Tests - Kevin Burke
Here are some of the different strategies you can use to write tests that read or write data from a database, and the...
Read more >Why do running tests in parallel makes APEX CPU Timeout ...
It tends to manifest in one of two ways when parallel testing is enabled: As you found, Tests fail with APEX CPU Timeout...
Read more >How To _Avoid_ Parallel Execution of Tests in Go
Because in some circumstances, this can cause random failures and even a loss of ... Allow parallel execution of test functions that call...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I removed the reference and again I get the following errors:
I found some more information here: https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-known-issues.md#net-core-312-sdk-31102-sdk
So I will add the reference again as long as this is not fixed by MS. If there is another way please let me know. Maybe you will get the same issue when upgrading the SDK?
I don’t want to enforce latest packages only. I just update from time to time but I agree that we can stick to older versions as long everything works fine. I will revert the updates. But I will keep updating the nugets for the stand alone applications like MQTTnet.Server and the UWP test app.
that is strange I was able to build when I removed it 2.1 to 3.1
it is available since last december https://dotnet.microsoft.com/download/dotnet-core/3.1
I would say as long as it builds just dont update. Or change the “policy” to only support latest packages