Skip to content

Conversation

@akarnokd
Copy link
Collaborator

@akarnokd akarnokd commented Jul 3, 2018

This PR fixes the StackOverflowException when a long running ObserveOn (> 100.000 items) gets disposed due to the ScheduledItems linked together when using the recursive scheduler.

The fix is to track the next recursive task's disposable directly and not allow the chaining to happen. For reference, this is the same effect that had to be considered in the improved Range and ToObservable implementations.

var d = recursiveScheduler.Schedule(this, DRAIN_SHORT_RUNNING);
Disposable.TrySetMultiple(ref _task, d);
}
return Disposable.Empty;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it at least return this here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would recurse upon calling Dispose() for no practical purpose. The public void Dispose() takes care of the cleanup when the downstream disposes, including the outstanding tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants