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

PythonEngine shutdown exceptions masked by subject disposed error #20

Open
glopesdev opened this issue Jun 21, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@glopesdev
Copy link
Member

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.

@glopesdev glopesdev added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant