-
Notifications
You must be signed in to change notification settings - Fork 3
POC Non static future in unsafe jar (with Factory::open
support but also more complexity...)
#11
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
Conversation
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.
// cannot outlive it. | ||
// This also means `DeferredRunning.future_done_rx` shares the same lifetime than the | ||
// future, and we systematically check this object is still alive (using | ||
// `tx.is_cancelled()`) before polling the future. |
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.
Actually… this is not safe, because DeferredRunning
could be leaked. So this fails due to the leakpocalypse 😭
Too bad, I was thinking that your approach was even cleaner than mine, based on the Rc
's refcount!
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.
Ah you're right, if we leak DeferredRunning
then the pinned future may get deleted while the tx.is_cancelled()
still returns false
😭
Since this structure is purely internal to indexed-db
there is no risk of crazy misuse by 3rd party actors, but even without I can understand you don't want to introduce such footgun ;-)
Be careful though ! PR #10 is passing the tests fine, but this one has some hiccup with the panic tests
I was debugging it when I noticed your messages, so I'm going to leave it as is (just tell me if you think this approach might be worth putting more effort in it ^^). |
Got it, thank you! And you're right I only grepped for the Unfortunately due to the leakpocalypse issue I don't think this option is viable 😢 I'm trying to get the rc-refcount solution (that works the other way around, by ensuring all references have been dropped, so leaking would just result in an abort) to work with the version upgrade transaction, hope I'll get something working! And thank you for all your efforts anyway, regardless of which PR ends up landing 💜 |
No description provided.