-
Notifications
You must be signed in to change notification settings - Fork 802
Crash when eval "Fiber.yield" #3415
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
Comments
For context, this is a bug that we ran into while looking for a way to load and evaluate a code within a fiber. In H2O, we would like to evaluate mruby code that defines a Rack handler within a fiber, so that when a blocking operation is triggered within the evaluation Essentially, we would like to allow users to write something like the snippet below, which will be evaluated within a fiber (note: # cache the response from http://upstream, and use it for every request
cached_resp = http_request("http://upstream/").join[2].join
Proc.new do |env|
[200, [], [cached_resp]]
end |
It's not possible, mruby's fiber cannot cross C function boundaries, although causing SEGV is a bug. |
@matz Thank you for the clarification. The reasoning sounds totally reasonable that you cannot call OTOH, may I ask if you have any idea that we could solve the issue? As stated in #3415 (comment) what we want to do is to evaluate user-specified script in a child fiber. We are more than happy to write such solution in C. |
Another question: are there standard ways to generate We found that we can address the issue described in #3415 (comment) in another way, by passing the compiled code to some preparing method as a proc. Like the following, def prepare_app(compiled_proc)
Fiber.new do
compiled_proc.call
end.resume
end But as far as I see the mruby API, there seems to be no ways to do it. Thank you in advance. |
Sorry, I mistakenly closed this issue |
48e0bbb allows you to call |
The following code causes a crash with a SEGV.
Is this possible in mruby?
The text was updated successfully, but these errors were encountered: