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

InvalidOperationException occurs when connection lost due to server termination #13

Open
ghost opened this issue Mar 23, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Mar 23, 2021

Sometimes when server terminates (in my case that's due to dev process), I'm getting unhandled InvalidOperationException with following StackTrace:

  at Socket.Io.Client.Core.SocketIoClient.ThrowIfNotRunning () [0x0001d] in <bbaaad4edc1b4f24be66d9e834056ead>:0 
  at Socket.Io.Client.Core.SocketIoClient.Send (Socket.Io.Client.Core.Model.SocketIo.Packet packet) [0x00000] in <bbaaad4edc1b4f24be66d9e834056ead>:0 
  at Socket.Io.Client.Core.SocketIoClient.<OnHandshake>b__41_0 (System.Int64 i) [0x00030] in <bbaaad4edc1b4f24be66d9e834056ead>:0 
  at System.Reactive.AnonymousSafeObserver`1[T].OnNext (T value) [0x0000a] in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:43 
  at System.Reactive.Sink`1[TTarget].ForwardOnNext (TTarget value) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:49 
  at System.Reactive.Linq.ObservableImpl.Timer+Periodic+_.Tick () [0x00011] in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Timer.cs:168 
  at System.Reactive.Linq.ObservableImpl.Timer+Periodic+_+<>c.<Run>b__4_0 (System.Reactive.Linq.ObservableImpl.Timer+Periodic+_ this) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Timer.cs:141 
  at System.Reactive.Concurrency.Scheduler+<>c__67`1[TState].<SchedulePeriodic>b__67_0 (System.ValueTuple`2[T1,T2] t) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/Scheduler.Services.Emulation.cs:79 
  at (wrapper delegate-invoke) System.Func`2[System.ValueTuple`2[System.Reactive.Linq.ObservableImpl.Timer+Periodic+_,System.Action`1[System.Reactive.Linq.ObservableImpl.Timer+Periodic+_]],System.ValueTuple`2[System.Reactive.Linq.ObservableImpl.Timer+Periodic+_,System.Action`1[System.Reactive.Linq.ObservableImpl.Timer+Periodic+_]]].invoke_TResult_T(System.ValueTuple`2<System.Reactive.Linq.ObservableImpl.Timer/Periodic/_, System.Action`1<System.Reactive.Linq.ObservableImpl.Timer/Periodic/_>>)
  at System.Reactive.Concurrency.DefaultScheduler+PeriodicallyScheduledWorkItem`1+<>c[TState].<Tick>b__5_0 (System.Reactive.Concurrency.DefaultScheduler+PeriodicallyScheduledWorkItem`1[TState] closureWorkItem) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs:127 
  at System.Reactive.Concurrency.AsyncLock+<>c__5`1[TState].<Wait>b__5_0 (System.Delegate actionObject, System.Object stateObject) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs:53 
  at System.Reactive.Concurrency.AsyncLock.Wait (System.Object state, System.Delegate delegate, System.Action`2[T1,T2] action) [0x0009a] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs:105 
  at System.Reactive.Concurrency.AsyncLock.Wait[TState] (TState state, System.Action`1[T] action) [0x0000e] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/AsyncLock.cs:53 
  at System.Reactive.Concurrency.DefaultScheduler+PeriodicallyScheduledWorkItem`1[TState].Tick () [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/DefaultScheduler.cs:125 
  at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl+PeriodicTimer.Tick () [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs:210 
  at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl+PeriodicTimer+<>c.<.ctor>b__2_0 (System.Object this) [0x00000] in /_/Rx.NET/Source/src/System.Reactive/Concurrency/ConcurrencyAbstractionLayerImpl.cs:207 
  at System.Threading.Timer+Scheduler.TimerCB (System.Object o) [0x00007] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/corlib/System.Threading/Timer.cs:369 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00015] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1337 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:899 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1261 

My expectation for this case is to get ErrorEvent or ProbeErrorEvent in appropriate observable, but they aren't called. As this isn't called from my code, but from scheduled in library periodic task, I have no way of handling that exception.

@LadislavBohm LadislavBohm self-assigned this Mar 24, 2021
@LadislavBohm LadislavBohm added the bug Something isn't working label Mar 24, 2021
@ghost
Copy link
Author

ghost commented Mar 25, 2021

@LadislavBohm Are you gonna fix that soon? Otherwise I can try to address it and create PR (I might have some time on weekend).
Thank you!

@LadislavBohm
Copy link
Owner

@arctouch-alexanderburov Thanks I wanted to look at it through weekend as well.

I can see I am throwing this in a guard protecting calls to emitting events and sending packets. It is IMO ok to throw this on methods called by user like "Emit" or "EmitAcknowledge", but it is not ok to throw in ping/pong, handshake and other packet sending that happens within the socket client itself.
If you can create a PR it would be awesome, I will look at it ASAP.

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