Skip to content
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: Identified and fixed a memory leak from JsRuntime #240

Closed
wants to merge 3 commits into from

Conversation

nyannyacha
Copy link
Collaborator

What kind of change does this PR introduce?

Bug fix

Description

This PR fixes the memory leakage from JsRuntime.

I've already written some commits to the upstream fork to fix the memory leak problem.

The PR brings in that fork using the cargo patch12.

CAVEATS: PR makes edge-runtime depend on the my upstream fork. If you have a plan that will manage upstream changes manually, it would make sense for the Supabase team to take my fork to your org repo first.

Resolves #212

cc @laktek
😋

Footnotes

  1. https://github.com/nyannyacha/rusty_v8/tree/rokat

  2. https://github.com/nyannyacha/deno_core/tree/222

@laktek
Copy link
Contributor

laktek commented Jan 8, 2024

Have you opened PRs for deno_core and rusty_v8? We would have to stick to official releases due to supply chain security. We can merge this once those changes are pushed to upstream.

@nyannyacha
Copy link
Collaborator Author

nyannyacha commented Jan 8, 2024

@laktek No, I didn't. Instead, I opened the issue12 a few weeks ago to give a chance to them to fix the problem correctly.

Footnotes

  1. https://github.com/denoland/deno_core/issues/386

  2. https://github.com/denoland/rusty_v8/issues/1348#issuecomment-1871781897

I had to use the cargo patch to fix the memory leakage problem because the root
cause of the memory leak belonged to `deno_core`.

Eventually, these changes should be tracked at `deno_core`; so until fixing this
problem upstream, we have to use the patch.

It could be the substantial solution for supabase#212 and
supabase#192 (on the assumption that I found all memory leakage
places of `JsRuntime` 😋 For reference, Valgrind no longer reported definite
memory leakage after this patch)

(cherry picked from commit bc631b4)
This commit reflects upstream dependency changes that turn off the submodule
update.

(cherry picked from commit 4089d22)
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.

supabase functions serve runs out of memory and crashes with basic usage
2 participants