NethermindEth / nethermind

A robust execution client for Ethereum node operators.
https://nethermind.io/nethermind-client
GNU General Public License v3.0
1.22k stars 428 forks source link

Test suite fails when not using `release` config #7285

Open emlautarom1 opened 1 month ago

emlautarom1 commented 1 month ago

Description

Our current test suite fails for some modules when no configuration is provided (defaulting most likely to Debug)

Steps to Reproduce

  1. Clone the repository
  2. Run cd src/Nethermind
  3. Run dotnet test Nethermind.Evm.Test.
  4. Run dotnet test Nethermind.Evm.Test -c release.

Actual behavior The test suite fails when no config is provided

Expected behavior The test suite should pass with any configuration

Desktop (please complete the following information): Please provide the following information regarding your setup:

Logs Exception stack trace:

The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.InvalidOperationException: ArrayPoolList hasn't been disposed. Created    at Nethermind.Core.Collections.ArrayPoolList`1..ctor(ArrayPool`1 arrayPool, Int32 capacity, Int32 startingCount)
   at Nethermind.Core.Collections.ArrayPoolList`1..ctor(Int32 capacity)
   at Nethermind.Evm.Tracing.GethStyle.Custom.Native.Call.NativeCallTracerCallFrame..ctor()
   at Nethermind.Evm.Tracing.GethStyle.Custom.Native.Call.NativeCallTracer.ReportAction(Int64 gas, UInt256 value, Address from, Address to, ReadOnlyMemory`1 input, ExecutionType callType, Boolean isPrecompileCall)
   at Nethermind.Evm.VirtualMachine`1.Run[TTracingActions](EvmState state, IWorldState worldState, ITxTracer txTracer)
   at Nethermind.Evm.VirtualMachine.Run[TTracingActions](EvmState state, IWorldState worldState, ITxTracer txTracer)
   at Nethermind.Evm.TransactionProcessing.TransactionProcessor.ExecuteEvmCall(Transaction tx, BlockHeader header, IReleaseSpec spec, ITxTracer tracer, ExecutionOptions opts, Int64& gasAvailable, ExecutionEnvironment& env, TransactionSubstate& substate, Int64& spentGas, Byte& statusCode)
   at Nethermind.Evm.TransactionProcessing.TransactionProcessor.Execute(Transaction tx, BlockExecutionContext& blCtx, ITxTracer tracer, ExecutionOptions opts)
   at Nethermind.Evm.TransactionProcessing.TransactionProcessor.Execute(Transaction transaction, BlockExecutionContext& blCtx, ITxTracer txTracer)
   at Nethermind.Evm.TransactionProcessing.TransactionProcessor.Nethermind.Evm.TransactionProcessing.ITransactionProcessor.Execute(Transaction transaction, BlockExecutionContext& blCtx, ITxTracer txTracer)
   at Nethermind.Evm.Test.VirtualMachineTestsBase.Execute[T](T tracer, Byte[] code, Nullable`1 forkActivation)
   at Nethermind.Evm.Test.Tracing.GethLikeCallTracerTests.ExecuteCallTrace(Byte[] code, String tracerConfig)
   at Nethermind.Evm.Test.Tracing.GethLikeCallTracerTests.Test_CallTrace_SelfDestruct()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at NUnit.Framework.Internal.Reflect.InvokeMethod(MethodInfo method, Object fixture, Object[] args)
   at NUnit.Framework.Internal.MethodWrapper.Invoke(Object fixture, Object[] args)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.InvokeTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
   at NUnit.Framework.Internal.Execution.WorkItem.Execute()
   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work, ParallelExecutionStrategy strategy)
   at NUnit.Framework.Internal.Execution.ParallelWorkItemDispatcher.Dispatch(WorkItem work)
   at NUnit.Framework.Internal.Execution.CompositeWorkItem.RunChildren()
   at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformWork()
   at NUnit.Framework.Internal.Execution.WorkItem.RunOnCurrentThread()
   at NUnit.Framework.Internal.Execution.WorkItem.Execute()
   at NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at Nethermind.Core.Collections.ArrayPoolList`1.Finalize() in /home/emlautarom1/dev/nethermind/src/Nethermind/Nethermind.Core/Collections/ArrayPoolList.cs:line 359
emlautarom1 commented 1 month ago

The issue seems due to this check that only exists in DEBUG builds:

https://github.com/NethermindEth/nethermind/blob/54f5817f04abab4f3a588d40fdfe7cc155675353/src/Nethermind/Nethermind.Core/Collections/ArrayPoolList.cs#L352-L362

This could be due to the test suite not properly releasing resources (missing .Dispose() or using). In the meantime, if you happen to see the same issue when running the test suite from your IDE like me, make sure that you use a Release profile.

emlautarom1 commented 1 month ago

Relevant: #7186