diff --git a/plugins/fiber/fiber.c b/plugins/fiber/fiber.c index 9eaffeee..63ea3210 100644 --- a/plugins/fiber/fiber.c +++ b/plugins/fiber/fiber.c @@ -58,11 +58,13 @@ void fiber_loop() { uwsgi.schedule_to_main = fiber_schedule_to_main; uwsgi.schedule_to_req = fiber_schedule_to_req; + ur.unprotected = 1; + rb_protect(protected_async_loop, 0, &error); if (error) { uwsgi_ruby_exception(); - exit(1); + exit(1); } // never here diff --git a/plugins/rack/rack_plugin.c b/plugins/rack/rack_plugin.c index 3096c339..0dfc442d 100644 --- a/plugins/rack/rack_plugin.c +++ b/plugins/rack/rack_plugin.c @@ -590,7 +590,6 @@ int uwsgi_rack_request(struct wsgi_request *wsgi_req) { rb_hash_aset(env, rb_str_new2("rack.errors"), rb_funcall( rb_const_get(rb_cObject, rb_intern("IO")), rb_intern("new"), 2, INT2NUM(2), rb_str_new("w",1) )); - ret = rb_protect( call_dispatch, env, &error); if (error) { uwsgi_ruby_exception(); @@ -674,9 +673,14 @@ int uwsgi_rack_request(struct wsgi_request *wsgi_req) { } } else if (rb_respond_to( body, rb_intern("each") )) { - rb_protect( iterate_body, body, &error); - if (error) { - uwsgi_ruby_exception(); + if (ur.unprotected) { + iterate_body(body); + } + else { + rb_protect( iterate_body, body, &error); + if (error) { + uwsgi_ruby_exception(); + } } } diff --git a/plugins/rack/uwsgi_rack.h b/plugins/rack/uwsgi_rack.h index c67613a8..5ba0c789 100644 --- a/plugins/rack/uwsgi_rack.h +++ b/plugins/rack/uwsgi_rack.h @@ -69,6 +69,8 @@ struct uwsgi_rack { int rb_shell; int app_id; + int unprotected; + struct uwsgi_string_list *rbrequire; };