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

Segfault with any non-trivial function content (e.g. a call to fetch) #200

Closed
2 tasks done
donalffons opened this issue Nov 6, 2023 · 3 comments · Fixed by #227
Closed
2 tasks done

Segfault with any non-trivial function content (e.g. a call to fetch) #200

donalffons opened this issue Nov 6, 2023 · 3 comments · Fixed by #227
Labels
C-bug Category: something isn't working released

Comments

@donalffons
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

The following edge function

// hello/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

serve(async (req) => {
  console.log("starting 'hello'");
  await fetch("https://www.google.com");
  console.log("end");
  return new Response("ok");
});

results in the following output:

main function started
serving the request with /home/deno/functions/hello
[Info] Listening on http://localhost:9999/

[Info] starting 'hello'

Segmentation fault (core dumped)

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. (git clone git@github.com:supabase/supabase.git && cd supabase/docker)
  2. docker run -it --net=host --entrypoint=/bin/bash -v ./volumes/functions:/home/deno/functions supabase/edge-runtime:v1.22.3
  3. On the host system, edit volumes/functions/hello/index.ts to contain the example code above
  4. Inside the container, run edge-runtime start --port 9000 --main-service /home/deno/functions/main
  5. On the host system, run curl http://localhost:9000/hello

System information

  • OS: Manjaro Linux 23.1.0

PS: Thank you for your great work on Supabase! I've been enjoying working with it a lot and we're planning to use it on many upcoming projects.

@donalffons donalffons added the C-bug Category: something isn't working label Nov 6, 2023
@donalffons
Copy link
Author

donalffons commented Nov 6, 2023

...I just realized that this is most likely a duplicate of #199. The error seems to occur with any non-trivial function content that takes longer than a few ms to execute. Here is another example:

// hello/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

serve(async (req) => {
  console.log("start");
  function busyWait(duration) {
    const end = Date.now() + duration;
    while (Date.now() < end) { }
  }
  busyWait(100);
  console.log("end");
  return new Response("ok");
});

@donalffons
Copy link
Author

...and as mentioned in #199, I can confirm that the error doesn't appear using version v1.21.1 of the docker image.

Copy link

github-actions bot commented Dec 6, 2023

🎉 This issue has been resolved in version 1.29.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant