[bug]: ResourceWatcher stops working after leadership changes
See original GitHub issueDescribe the bug
When the leadership changes the ResourceWatcher
throws an unobserved exception:
System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. (Cannot access a disposed object.)
---> System.ObjectDisposedException: Cannot access a disposed object.
at System.Reactive.Subjects.Subject`1.ThrowDisposed() in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 53
at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 141
at KubeOps.Operator.Kubernetes.ResourceWatcher`1.OnException(Exception e)
at k8s.Watcher`1.WatcherLoop(CancellationToken cancellationToken)
at k8s.Watcher`1.<.ctor>b__9_0()
My suspicion is that this happens after calling the StartAsync
again on the same instance after StopAsync
.
The problem could be fixed by removing this line where the _reconnectHandler
is disposed again outside of the previous if (!fromStop)
clause.
To reproduce
Change the leadership from LeaderState.Leader
to LeaderState.Candidate
and back to LeaderState.Leader
.
Expected behavior
The resource watcher should not stop watching after leadership changed.
Screenshots
No response
Additional Context
I can prepare a PR if you will confirm that the issue is legitimate. Could be related to #482.
Issue Analytics
- State:
- Created 8 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Unhandled exception. System.NotSupportedException and ...
the operator project is run locally .. when a crd instance is created I get the notification ... Leadership state changed to: Leader....
Read more >[Bug] Crusaders "Aura of Leadership" was does not work ...
The regenerative wards are still not working correctly and need to be recast in each zone/instance that is subject to healing mitigations.
Read more >[Bug] Crusaders "Aura of Leadership" was does not work ...
You really should try recasting Aura of the Crusader and Blessing of the Paladin during combat when your stats are at their highest....
Read more >Employees Are Losing Patience with Change Initiatives
Unfortunately, many leaders are approaching change management by applying short-term fixes, which is unsustainable. The Big Pitfall: Moving Too ...
Read more >How Leaders Can Communicate Change to a Burned-Out ...
Navigate the pressures of organizational change with a communication technique called "chunking."
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok no problem if it is a hassle, we will upgrade our operator to v7.
Hey @tomasfabian Hmm… are you not able to upgrade to 7? backporting is kind of a burden and I need more time to set up release/support branches for semantic release