apache / lucenenet

Apache Lucene.NET
https://lucenenet.apache.org/
Apache License 2.0
2.24k stars 639 forks source link

Test Failure: Lucene.Net.Expressions.JS.TestJavascriptOperations (TestBitShiftLeft() and TestBitShiftRight()) on x86 #1034

Open NightOwl888 opened 6 days ago

NightOwl888 commented 6 days ago

Is there an existing issue for this?

Describe the bug

Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft() and Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftRight() failed on net48 and net471 when running on Azure DevOps. This is probably intermittent, so I am including the random info to repeat.

Expected Behavior

The tests should not fail.

Steps To Reproduce

See the exception message.

Exceptions (if any)

Lucene.Net.Expressions.JS.TestJavascriptOperations::TestBitShiftLeft(), net48

Expected: -268480, Actual: -1153112819630080

To reproduce this test result:

Option 1:

Apply the following assembly-level attributes:

[assembly: Lucene.Net.Util.RandomSeed("0x4fb0a6a45c287ab0")]
[assembly: NUnit.Framework.SetCulture("en-IN")]

Option 2:

Use the following .runsettings file:

<RunSettings>
  <TestRunParameters>
    <Parameter name="tests:seed" value="0x4fb0a6a45c287ab0" />
    <Parameter name="tests:culture" value="en-IN" />
  </TestRunParameters>
</RunSettings>
Option 3:

Create the following lucene.testsettings.json file somewhere between the test assembly and the root of your drive:

{
"tests": {
"seed": "0x4fb0a6a45c287ab0",
"culture": "en-IN"
}
}

Stack Trace

at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in /_/src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 348 at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 33 at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 271 1) at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in //src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 349 [at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in //src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 34](https://dev.azure.com/shad0962/Experiments/_git/4882ad91-3a7d-453c-bd92-8068ed8f2711?path=%2F_%2Fsrc%2FLucene.Net.Tests.Expressions%2FJS%2FTestJavascriptOperations.cs&version=GBfix%2FGH-1025-encoding-providers-netstandard2.0&_a=contents&line=34&lineEnd=35&lineStartColumn=1&lineEndColumn=1&lineStyle=plain) at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 272

Lucene.Net.Expressions.JS.TestJavascriptOperations::TestBitShiftRight(), net48

Expected: -4195, Actual: -1

To reproduce this test result:

Option 1:

Apply the following assembly-level attributes:

[assembly: Lucene.Net.Util.RandomSeed("0x4fb0a6a45c287ab0")]
[assembly: NUnit.Framework.SetCulture("en-IN")]

Option 2:

Use the following .runsettings file:

<RunSettings>
  <TestRunParameters>
    <Parameter name="tests:seed" value="0x4fb0a6a45c287ab0" />
    <Parameter name="tests:culture" value="en-IN" />
  </TestRunParameters>
</RunSettings>
Option 3:

Create the following lucene.testsettings.json file somewhere between the test assembly and the root of your drive:

{
"tests": {
"seed": "0x4fb0a6a45c287ab0",
"culture": "en-IN"
}
}

Stack Trace

at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in /_/src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 348 at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 33 at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftRight() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 287 1) at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in //src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 349 [at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in //src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 34](https://dev.azure.com/shad0962/Experiments/_git/4882ad91-3a7d-453c-bd92-8068ed8f2711?path=%2F_%2Fsrc%2FLucene.Net.Tests.Expressions%2FJS%2FTestJavascriptOperations.cs&version=GBfix%2FGH-1025-encoding-providers-netstandard2.0&_a=contents&line=34&lineEnd=35&lineStartColumn=1&lineEndColumn=1&lineStyle=plain) at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftRight() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 288

Lucene.Net.Expressions.JS.TestJavascriptOperations::TestBitShiftLeft(), net471

Expected: -268480, Actual: -1153112819630080

To reproduce this test result:

Option 1:

Apply the following assembly-level attributes:

[assembly: Lucene.Net.Util.RandomSeed("0x7514e82652ef5b73")]
[assembly: NUnit.Framework.SetCulture("dje-NE")]

Option 2:

Use the following .runsettings file:

<RunSettings>
  <TestRunParameters>
    <Parameter name="tests:seed" value="0x7514e82652ef5b73" />
    <Parameter name="tests:culture" value="dje-NE" />
  </TestRunParameters>
</RunSettings>
Option 3:

Create the following lucene.testsettings.json file somewhere between the test assembly and the root of your drive:

{
"tests": {
"seed": "0x7514e82652ef5b73",
"culture": "dje-NE"
}
}

Stack Trace

at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in /_/src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 348 at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 33 at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 271 1) at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in //src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 349 [at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in //src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 34](https://dev.azure.com/shad0962/Experiments/_git/4882ad91-3a7d-453c-bd92-8068ed8f2711?path=%2F_%2Fsrc%2FLucene.Net.Tests.Expressions%2FJS%2FTestJavascriptOperations.cs&version=GBfix%2FGH-1025-encoding-providers-netstandard2.0&_a=contents&line=34&lineEnd=35&lineStartColumn=1&lineEndColumn=1&lineStyle=plain) at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 272

Lucene.Net.Expressions.JS.TestJavascriptOperations::TestBitShiftRight(), net471

Expected: -4195, Actual: -1

To reproduce this test result:

Option 1:

Apply the following assembly-level attributes:

[assembly: Lucene.Net.Util.RandomSeed("0x7514e82652ef5b73")]
[assembly: NUnit.Framework.SetCulture("dje-NE")]

Option 2:

Use the following .runsettings file:

<RunSettings>
  <TestRunParameters>
    <Parameter name="tests:seed" value="0x7514e82652ef5b73" />
    <Parameter name="tests:culture" value="dje-NE" />
  </TestRunParameters>
</RunSettings>
Option 3:

Create the following lucene.testsettings.json file somewhere between the test assembly and the root of your drive:

{
"tests": {
"seed": "0x7514e82652ef5b73",
"culture": "dje-NE"
}
}

Stack Trace

at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in /_/src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 348 at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 33 at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftRight() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 287 1) at Lucene.Net.TestFramework.Assert.AreEqual(Int64 expected, Int64 actual) in //src/Lucene.Net.TestFramework/Support/TestFramework/Assert.cs:line 349 [at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(String expression, Int64 expected) in //src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 34](https://dev.azure.com/shad0962/Experiments/_git/4882ad91-3a7d-453c-bd92-8068ed8f2711?path=%2F_%2Fsrc%2FLucene.Net.Tests.Expressions%2FJS%2FTestJavascriptOperations.cs&version=GBfix%2FGH-1025-encoding-providers-netstandard2.0&_a=contents&line=34&lineEnd=35&lineStartColumn=1&lineEndColumn=1&lineStyle=plain) at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftRight() in /_/src/Lucene.Net.Tests.Expressions/JS/TestJavascriptOperations.cs:line 288

Lucene.NET Version

No response

.NET Version

.NET Framework

Operating System

windows-latest

Anything else?

https://dev.azure.com/shad0962/Experiments/_build/results?buildId=2525&view=ms.vss-test-web.build-test-results-tab

It only seems to fail on x86, never x64.

NightOwl888 commented 6 days ago

This is a bit worse than I thought. Not only are there intermittent test failures on .NET Framework, but there are frequent crashes when testing .NET Core, x86 on Windows (it failed on both net6.0 and net5.0 and I haven't yet had a successful run).

Here is the stderr output from the net6.0 run:

The active test run was aborted. Reason: Test host process crashed :    at Lucene.Net.Expressions.JS.TestCustomFunctions.StaticThrowingException.Method() in /_/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs:line 215
   at Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32 , FunctionValues[] )
   at Lucene.Net.Expressions.JS.TestCustomFunctions.TestThrowingException() in /_/src/Lucene.Net.Tests.Expressions/JS/TestCustomFunctions.cs:line 231
Fatal error. 0xC0000005
   at Lucene.Net.Expressions.CompiledExpression.Evaluate(Int32, Lucene.Net.Queries.Function.FunctionValues[])
   at Lucene.Net.Expressions.JS.TestJavascriptOperations.AssertEvaluatesTo(System.String, Int64)
   at Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft()
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, System.Span`1<System.Object> ByRef, System.Signature, Boolean, Boolean)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.Reflection.MethodBase.Invoke(System.Object, System.Object[])
   at NUnit.Framework.Internal.Reflect.InvokeMethod(System.Reflection.MethodInfo, System.Object, System.Object[])
   at NUnit.Framework.Internal.MethodWrapper.Invoke(System.Object, System.Object[])
   at NUnit.Framework.Internal.Commands.TestMethodCommand.InvokeTestMethod(NUnit.Framework.Internal.TestExecutionContext)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(NUnit.Framework.Internal.TestExecutionContext)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(NUnit.Framework.Internal.TestExecutionContext)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand+<>c__DisplayClass1_0.<Execute>b__0()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(NUnit.Framework.Internal.TestExecutionContext, System.Action)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.Execute(NUnit.Framework.Internal.TestExecutionContext)
   at NUnit.Framework.Internal.Commands.TimeoutCommand+<>c__DisplayClass5_0.<RunTestOnSeparateThread>b__0()
   at System.Threading.Tasks.Task`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke()
   at System.Threading.Tasks.Task+<>c.<.cctor>b__272_0(System.Object)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteEntryUnsafe(System.Threading.Thread)
   at System.Threading.Tasks.Task.ExecuteFromThreadPool(System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

Test Run Aborted.
The active Test Run was aborted because the host process exited unexpectedly. Please inspect the call stack above, if available, to get more information about where the exception originated from.
The test running when the crash occurred: 
Lucene.Net.Expressions.JS.TestJavascriptOperations.TestBitShiftLeft

This test may, or may not be the source of the crash.

Here are links to the runs where logs and other artifacts can be downloaded:

https://dev.azure.com/LuceneNET-Temp/Lucene.NET/_build/results?buildId=2375&view=results https://dev.azure.com/lucene-net-temp2/Lucene.NET/_build/results?buildId=1073&view=results

paulirwin commented 6 days ago

Thanks for the details, since this was my PR I'll take this one.