question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chkr1011commented, May 25, 2020

I removed the reference and again I get the following errors:

image

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.

0reactions
JanEggerscommented, May 25, 2020

so adding it manually will solve building issues.

that is strange I was able to build when I removed it 2.1 to 3.1

I will revert it as soon as a new .net core 3.1 SDK is available.

it is available since last december https://dotnet.microsoft.com/download/dotnet-core/3.1

Is there a way to “block” nuget updates?

I would say as long as it builds just dont update. Or change the “policy” to only support latest packages

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found