Forum: Ruby-core [Ruby 1.9.2-Backport#3762][Open] c++ exceptions result in segfault when raised in rb_thread_blocking

Posted by Bharanee Rathna (Guest)
on 2010-08-30 02:30
(Received via mailing list)
Backport #3762: c++ exceptions result in segfault when raised in 
rb_thread_blocking_region callback
http://redmine.ruby-lang.org/issues/show/3762

Author: Bharanee Rathna
Status: Open, Priority: Normal

http://gist.github.com/556829

This works under ruby1.9.1 but segfaults on 1.9.2 - any insights or 
suggestions would be much appreciated.

Thanks
Posted by Eric Wong (Guest)
on 2010-08-30 06:00
(Received via mailing list)
Bharanee Rathna <redmine@ruby-lang.org> wrote:
> Backport #3762: c++ exceptions result in segfault when raised in rb_thread_blocking_region callback
> http://redmine.ruby-lang.org/issues/show/3762
> 
> Author: Bharanee Rathna
> Status: Open, Priority: Normal
> 
> http://gist.github.com/556829

> This works under ruby1.9.1 but segfaults on 1.9.2 - any insights or
> suggestions would be much appreciated.

rb_thread_blocking_region in 1.9.1 is less robust and you can probably
get away with mistakes like this as a result.

Instead, you should catch inside blocking_function (or write a wrapper
function to catch and pass that wrapper to TBR instead).
Posted by Nobuyoshi Nakada (Guest)
on 2010-08-31 00:02
(Received via mailing list)
Issue #3762 has been updated by Nobuyoshi Nakada.

Category set to ext
Status changed from Open to Rejected

You can't break from blocking functions with C++ exception.
Ruby's exception mechanism which is implemented based on setjmp/longjmp 
is not compatible with C++'s one.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3762
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.