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

[test] SerializeTimeSpansAsTicksAndStrings randomly failed on CI #4423

Closed
Mpdreamz opened this issue Feb 21, 2020 · 9 comments
Closed

[test] SerializeTimeSpansAsTicksAndStrings randomly failed on CI #4423

Mpdreamz opened this issue Feb 21, 2020 · 9 comments

Comments

@Mpdreamz
Copy link
Member

https://dev.azure.com/azure3/elasticsearch-net/_build/results?buildId=3125&view=logs&j=b43a14c2-2046-5949-944a-5a4631b14be2&t=301652d8-af95-550e-0530-c591704039a1&l=126

[xUnit.net 00:00:02.9411802]     Tests.Reproduce.TimeSpanSerialization.SerializeTimeSpansAsTicksAndStrings [FAIL]
  X Tests.Reproduce.TimeSpanSerialization.SerializeTimeSpansAsTicksAndStrings [152ms]
  Error Message:
   Expected 104d, 10h, 38m and 32s, but found 10d, 10h, 38m and 32s.
  Stack Trace:
     at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message)
   at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args)
   at FluentAssertions.Primitives.SimpleTimeSpanAssertions.Be(TimeSpan expected, String because, Object[] becauseArgs)
   at Tests.Reproduce.TimeSpanSerialization.SerializeTimeSpansAsTicksAndStrings() in /home/vsts/work/1/s/tests/Tests.Reproduce/TimeSpanSerialization.cs:line 30
[xUnit.net 00:00:03.2945958]     Tests.Reproduce.GithubPR3815.CanDeserializeNestedError [SKIP]
  ! Tests.Reproduce.GithubPR3815.CanDeserializeNestedError [1ms]
@russcam
Copy link
Contributor

russcam commented Feb 23, 2020

The test is really simple; it's not obvious how the expected value was ascertained

@codebrain
Copy link
Contributor

Very strange. This is the test:

var timeSpans = new TimeSpans(TimeSpan.FromSeconds(902312));

As @russcam mentions, its very strange how expected is 104 days and not 10 days.

@russcam
Copy link
Contributor

russcam commented Feb 24, 2020

Couple of potential avenues to explore:

  1. Reuse of Memory stream and bytes written from MemoryStreamFactory. This seems unlikely because the written bytes would need to match the same JSON structure to deserialize correctly.
  2. Concurrency race condition in serialization

@codebrain
Copy link
Contributor

codebrain commented Feb 24, 2020

Side note;
9023120000000 ticks = 10.10:38:32
90231200000000 ticks = 104.10:25:20
90239120000000 ticks = 104.10:38:32

So, it looks as though there is an additional 9 at position 5 in the ticks count.

@russcam
Copy link
Contributor

russcam commented Feb 24, 2020

good catch. May need to dig into

internal sealed class ISO8601TimeSpanFormatter : IJsonFormatter<TimeSpan>

@codebrain
Copy link
Contributor

@Mpdreamz I am getting a 404 (build not found) on the above build link...

@Mpdreamz
Copy link
Member Author

Mpdreamz commented Mar 4, 2020

I think its been cleaned up.

@codebrain
Copy link
Contributor

Ah, OK, I think this is going to be hard to repro without the test run settings (seed). I'll leave the ticket open for the time being and if it occurs again we should document enough for a repro.

@russcam
Copy link
Contributor

russcam commented Jun 23, 2020

Not seen this issue surface again. Going to close this, and will reopen if resurfaces.

@russcam russcam closed this as completed Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants