Intermittent threading errors with FindLogEntries #246

Closed
opened 2025-12-29 15:19:00 +01:00 by adam · 4 comments
Owner

Originally created by @davidpene on GitHub (Jan 30, 2020).

When running tests in parallel, we intermittently get this exception:

System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at WireMock.Server.FluentMockServer.FindLogEntries(IRequestMatcher[] matchers) in /Server/FluentMockServer.LogEntries.cs:line 42
Originally created by @davidpene on GitHub (Jan 30, 2020). When running tests in parallel, we intermittently get this exception: ``` c# System.InvalidOperationException : Collection was modified; enumeration operation may not execute. at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at WireMock.Server.FluentMockServer.FindLogEntries(IRequestMatcher[] matchers) in /Server/FluentMockServer.LogEntries.cs:line 42 ```
adam added the bug label 2025-12-29 15:19:00 +01:00
adam closed this issue 2025-12-29 15:19:01 +01:00
Author
Owner

@NoahLerner commented on GitHub (Feb 27, 2020):

I'm trying to reliably reproduce this issue but could use some more information.
Are you running tests in parallel using the same WireMockServer instance? Or does each test create a new instance?

Additionally,

at WireMock.Server.FluentMockServer.FindLogEntries(IRequestMatcher[] matchers) in /Server/FluentMockServer.LogEntries.cs:line 42

does not point to a line of code in my version of the repo. Are you running the latest nuget package?

@NoahLerner commented on GitHub (Feb 27, 2020): I'm trying to reliably reproduce this issue but could use some more information. Are you running tests in parallel using the same `WireMockServer` instance? Or does each test create a new instance? Additionally, ```csharp at WireMock.Server.FluentMockServer.FindLogEntries(IRequestMatcher[] matchers) in /Server/FluentMockServer.LogEntries.cs:line 42 ``` does not point to a line of code in my version of the repo. Are you running the latest nuget package?
Author
Owner

@davidpene commented on GitHub (Feb 27, 2020):

We're running tests in parallel and using a static wiremock server to mock a single "api". We're using version 1.0.7. I'll bump to the latest 1.1.9.0 and let you know if the issue continues.

@davidpene commented on GitHub (Feb 27, 2020): We're running tests in parallel and using a static wiremock server to mock a single "api". We're using version `1.0.7`. I'll bump to the latest `1.1.9.0` and let you know if the issue continues.
Author
Owner

@NoahLerner commented on GitHub (Mar 5, 2020):

Hey David, did updating the nuget package resolve your issue?

@NoahLerner commented on GitHub (Mar 5, 2020): Hey David, did updating the nuget package resolve your issue?
Author
Owner

@davidpene commented on GitHub (Mar 5, 2020):

Hey @NoahLerner the issue was intermittent and it hasn't shown up again, so it may have been solved. Happy to close this issue and I'll reopen if I see it again.
Cheers

@davidpene commented on GitHub (Mar 5, 2020): Hey @NoahLerner the issue was intermittent and it hasn't shown up again, so it _may_ have been solved. Happy to close this issue and I'll reopen if I see it again. Cheers
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#246