Skip to content

Conversation

nyannyacha
Copy link
Contributor

What kind of change does this PR introduce?

Bug fix

Description

There is no explicit lifetime synchronization path between the supervisor and isolate, so we cannot assume that Isolate::request_interrupt will always be scheduled.

The IsolateInterruptData passed as an argument has always been passed to Box::into_raw, so if the isolation is ever destroyed, the step of converting it back to a Box<T> to free the memory is omitted. We should have looked at the result of the request_interrupt call and freed the passed arguments in some cases, but we didn't, which led to a memory leak.

There is no explicit lifetime synchronization path between the supervisor and
isolate, so we cannot assume that `Isolate::request_interrupt` will always be
scheduled.

The `IsolateInterruptData` passed as an argument has always been passed to
`Box::into_raw`, so if the isolation is ever destroyed, the step of converting
it back to a `Box<T>` to free the memory is omitted. We should have looked at
the result of the `request_interrupt` call and freed the passed arguments in
some cases, but we didn't, which led to a memory leak.

(cherry picked from commit 2790fa4)
@laktek laktek merged commit dcaaf35 into supabase:main Feb 6, 2024
Copy link

github-actions bot commented Feb 6, 2024

🎉 This PR is included in version 1.34.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@nyannyacha nyannyacha deleted the fix-req-interrupt-leak branch February 6, 2024 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants