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

Unknown method on Exception causes segfault #2457

Closed
p6rt opened this issue Aug 1, 2011 · 6 comments
Closed

Unknown method on Exception causes segfault #2457

p6rt opened this issue Aug 1, 2011 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Aug 1, 2011

Migrated from rt.perl.org#96028 (status was 'resolved')

Searchable as RT96028$

@p6rt
Copy link
Author

p6rt commented Aug 1, 2011

From brian.gernhardt@mail.rit.edu

While testing out CATCH, I tried the Rosetta Code example for exceptions​:

http://rosettacode.org/wiki/Exceptions#Perl_6

try { die "Help I'm dieing!"; CATCH { note $_.uc; say "Cough, Cough, Aiee!!" } }

CATCH { note "No you're not."; say $_; }

say "Yay. I'm alive.";

die "I'm dead.";

say "Arrgh.";

This quite unhelpfully segfaulted. I finally golfed it down to​:

die 'a'; CATCH { .uc }

Some experimenting discovered that any unknown method on an Exception causes a segfault​:

die 'a'; CATCH { .bogus }

@p6rt
Copy link
Author

p6rt commented Aug 1, 2011

From @pmichaud

This is very likely a duplicate of RT #​64262.

The problem is that exceptions thrown from inside of a CATCH block (in
this case, the "method not found exception" are then caught by the CATCH
block itself, which results in an infinite loop.

Rakudo uses Parrot ExceptionHandlers to implement CATCH blocks. We need
some way to temporarily disable an ExceptionHandler in Parrot, or
otherwise configure it so that it doesn't catch exceptions thrown from
inside the block.

Note that simply using "pop_eh" to remove the ExceptionHandler from the
stack is demonstrably wrong; the CATCH block might not be the top
ExceptionHandler on the stack, and we have to be able to restore the
handler in cases where the caught exception is handled and resumed.

Pm

@p6rt
Copy link
Author

p6rt commented Aug 1, 2011

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 15, 2012

From @jnthn

On Sun Jul 31 22​:22​:25 2011, brian.gernhardt@​mail.rit.edu wrote​:

While testing out CATCH, I tried the Rosetta Code example for
exceptions​:

http://rosettacode.org/wiki/Exceptions#Perl_6

try { die "Help I'm dieing!"; CATCH { note $_.uc; say "Cough, Cough,
Aiee!!" } }

CATCH { note "No you're not."; say $_; }

say "Yay. I'm alive.";

die "I'm dead.";

say "Arrgh.";

This quite unhelpfully segfaulted. I finally golfed it down to​:

die 'a'; CATCH { .uc }

Some experimenting discovered that any unknown method on an Exception
causes a segfault​:

die 'a'; CATCH { .bogus }

Many things have improved with exceptions in Rakudo of late, and it
seems those changes also fixed this bug; now​:

die 'a'; CATCH { .uc }
Method 'uc' not found for invocant of class 'Exception'
die 'a'; CATCH { .bogus }
Method 'bogus' not found for invocant of class 'Exception'

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

From @moritz

Exceptions are in no way special anymore, and we have tests for the
"method not found" error, so I'm closing this without extra tests.

@p6rt
Copy link
Author

p6rt commented Apr 5, 2012

@moritz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant