Skip to content

PythonEngine shutdown exceptions masked by subject disposed error #20

Open
@glopesdev

Description

@glopesdev

To reproduce, run the following on a clean WSL shell with .NET 8 SDK installed:

  1. Clone bonsai-rx/machinelearning
git clone https://github.com/bonsai-rx/machinelearning.git
git checkout a80e2540b5bab3a39456ed10e0ba8df63dd46d09
  1. dotnet test

This should cause the following error trace:

The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.ObjectDisposedException: Cannot access a disposed object.
   at System.Reactive.Subjects.ReplaySubject`1.ReplayBase.CheckDisposed()
   at System.Reactive.Subjects.ReplaySubject`1.ReplayBase.OnError(Exception error)
   at System.Reactive.Subjects.ReplaySubject`1.OnError(Exception error)
   at Bonsai.Scripting.Python.RuntimeManager.<>c__DisplayClass15_0.<Schedule>b__0()
   at System.Reactive.Concurrency.Scheduler.Invoke(Action action)
   at System.Reactive.Concurrency.Scheduler.<>c.<Schedule>b__74_0(IScheduler _, Action a)
   at System.Reactive.Concurrency.ScheduledItem`2.InvokeCore()
   at System.Reactive.Concurrency.ScheduledItem`1.Invoke()
   at System.Reactive.Concurrency.EventLoopScheduler.Run()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

We haven't fully determined the order which is causing the ObjectDisposedException, but the hypothesis is there is an asynchronous dispose call to the internal ReplaySubject storing the runtime, which then the asynchronous initialize call tries to use to route the shutdown exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions