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
fix(observeOn): release action references on teardown #6559
Conversation
cab448d
to
03cbdd8
Compare
03cbdd8
to
f47aa0c
Compare
@kwonoj I think the bug is somewhere else. The However, what I'm not seeing is where the I'm going to take a look at this. But I think maybe this isn't the right solution. Regardless, I'm really not a fan of our Scheduler architecture, and I'm going to be trying to think of ways to migrate us to something better soon. |
I think that's crux of this issue? afaik we don't have places action self-unsubscribes once it complets. This is essentially we did before, and refactoring removed it.
Fine for me.
I think most of us are on the same page, for me mostly where we have schedulers & schedules actions. |
@benlesh fyi, this is original fix we did around observeOn. (https://github.com/ReactiveX/rxjs/pull/2248/files#diff-3e90d4c179a0e06539c3b8d62f8b782c59630cdb4e65d44fd926ea2147145aa0R53) |
@kwonoj Okay, so digging into this.... There's some clean up I can do to the code but the reason we keep around the Actions is because of the design of rescheduling. Technically, you can reschedule an action Asynchronously because of closures therefor, we can't Ultimately, I now believe that this form of rescheduling is a design flaw that necessitates memory leaks or extra clean up code that requires "deep knowledge" of RxJS internals. Honestly, the requirement of "deep knowledge" of scheduler behaviors is one of the reasons I strongly believe using schedulers, in general, is inadvisable. I think long-term we need to move away from our current Scheduler architecture, and move towards something more simplified. In the short term, we can fix |
Yup, that's pretty much what I shared in slack channel.
agreed.
agreed again.
it is already happening anyway, isn't it? as long as someone uses scheduling, or even plain observeOn operator, they're hitting this.
I agree with all of this including long term fix. For now, I'd like to suggest short term fix to resurrect what we did previously, or similar way - while techinically it is not desirable, it is not breaking changes for the |
Just clarifying, I'm not saying this PR as-is should be checked in. I'm fine with other short term solutions. |
@@ -146,6 +146,8 @@ | |||
"@types/sinon": "4.1.3", | |||
"@types/sinon-chai": "2.7.29", | |||
"@types/source-map": "^0.5.2", | |||
"@typescript-eslint/eslint-plugin": "^4.29.1", | |||
"@typescript-eslint/parser": "^4.29.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like these are welcome changes... but are they necessary in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can spliot actually, it was due to I got annoyed editor actually failed to initiate eslint. Up to you - but this should be harmless for the fix itself & other editor experiences.
return operate((source, subscriber) => { | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kwonoj please review, I've changed the approach just a little bit, and I've added detailed comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
Citing @kwonoj's 🚢 here: #6559 (comment) in lieu of an approval, I'll take it. |
Description:
Looks like we regressed #2244 while refactoring.
This PR brings up theoritically same changes to old fixes to release references once action is dispatched.
I have verified manually via devtools, but not sure if there's good way to create test case for this. Previous test case was inspecting deep internals.
BREAKING CHANGE:
Related issue (if exists):