Add an exception handler around check for can __dump. #239

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
@KrisShannon

The 6model internals throw an exception here in some
circumstances stopping the nqp --target=past dumping
from working.

Add an exception handler around check for can __dump.
The 6model internals throw an exception here in some
circumstances stopping the nqp --target=past dumping
from working.
@leto

This comment has been minimized.

Show comment
Hide comment
@leto

leto Dec 31, 2011

Member

Can you add a test or give an example of NQP that triggers this code?

Member

leto commented Dec 31, 2011

Can you add a test or give an example of NQP that triggers this code?

@KrisShannon

This comment has been minimized.

Show comment
Hide comment
@KrisShannon

KrisShannon Dec 31, 2011

With the nqp from git://github.com/perl6/nqp.git running:

nqp --target=past -e 1

dies attempting to dump the EXPORTHOW PMC with:

No method cache and no find_method method in meta-object
current instr.: 'parrot;Data;Dumper;Default;pmcDefault' pc 242 (runtime/parrot/library/Data/Dumper/Default.pir:203)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Capture;__dump' pc 600 (runtime/parrot/library/Data/Dumper/Default.pir:454)
called from Sub 'parrot;Data;Dumper;Default;pmcDefault' pc 261 (runtime/parrot/library/Data/Dumper/Default.pir:208)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;dumper' pc 70 (runtime/parrot/library/Data/Dumper.pir:43)
called from Sub '_dumper' pc 56 (runtime/parrot/library/dumper.pir:89)
called from Sub 'nqp;HLL;Compiler;dumper' pc 38449 (src/stage2/gen/NQPHLL.pir:14059) (src/stage2/gen/NQPHLL.pm:1540)
called from Sub 'nqp;HLL;Compiler;_block1864' pc 35540 (src/stage2/gen/NQPHLL.pir:12596) (src/stage2/gen/NQPHLL.pm:1386)
called from Sub 'nqp;HLL;Compiler;command_eval' pc 34969 (src/stage2/gen/NQPHLL.pir:12356) (src/stage2/gen/NQPHLL.pm:1401)
called from Sub 'nqp;HLL;Compiler;command_line' pc 34633 (src/stage2/gen/NQPHLL.pir:12198) (src/stage2/gen/NQPHLL.pm:1353)
called from Sub 'MAIN' pc 14443 (src/stage2/gen/NQP.pir:3026) (src/stage2/gen/NQP.pm:2839)
called from Sub '_block1000' pc 196 (src/stage2/gen/NQP.pir:104) (src/stage2/gen/NQP.pm:1)

With the nqp from git://github.com/perl6/nqp.git running:

nqp --target=past -e 1

dies attempting to dump the EXPORTHOW PMC with:

No method cache and no find_method method in meta-object
current instr.: 'parrot;Data;Dumper;Default;pmcDefault' pc 242 (runtime/parrot/library/Data/Dumper/Default.pir:203)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;Default;genericHash' pc 184 (runtime/parrot/library/Data/Dumper/Default.pir:153)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Capture;__dump' pc 600 (runtime/parrot/library/Data/Dumper/Default.pir:454)
called from Sub 'parrot;Data;Dumper;Default;pmcDefault' pc 261 (runtime/parrot/library/Data/Dumper/Default.pir:208)
called from Sub 'parrot;Data;Dumper;Base;dump' pc 383 (runtime/parrot/library/Data/Dumper/Base.pir:251)
called from Sub 'parrot;Data;Dumper;Default;dumpWithName' pc 40 (runtime/parrot/library/Data/Dumper/Default.pir:56)
called from Sub 'parrot;Data;Dumper;dumper' pc 70 (runtime/parrot/library/Data/Dumper.pir:43)
called from Sub '_dumper' pc 56 (runtime/parrot/library/dumper.pir:89)
called from Sub 'nqp;HLL;Compiler;dumper' pc 38449 (src/stage2/gen/NQPHLL.pir:14059) (src/stage2/gen/NQPHLL.pm:1540)
called from Sub 'nqp;HLL;Compiler;_block1864' pc 35540 (src/stage2/gen/NQPHLL.pir:12596) (src/stage2/gen/NQPHLL.pm:1386)
called from Sub 'nqp;HLL;Compiler;command_eval' pc 34969 (src/stage2/gen/NQPHLL.pir:12356) (src/stage2/gen/NQPHLL.pm:1401)
called from Sub 'nqp;HLL;Compiler;command_line' pc 34633 (src/stage2/gen/NQPHLL.pir:12198) (src/stage2/gen/NQPHLL.pm:1353)
called from Sub 'MAIN' pc 14443 (src/stage2/gen/NQP.pir:3026) (src/stage2/gen/NQP.pm:2839)
called from Sub '_block1000' pc 196 (src/stage2/gen/NQP.pir:104) (src/stage2/gen/NQP.pm:1)
@leto

This comment has been minimized.

Show comment
Hide comment
@leto

leto Jan 1, 2012

Member

Just as a datapoint, "parrot-nqp --target=past -e 1" works fine as of parrot RELEASE_3_11_0-5-g2006557 .

@KrisShannon : Which SHA1 of nqp.git did this happen to you on?

Also, "No method cache and no find_method method in meta-object" sounds like a deeper problem, although I agree that nqp should not fail like this. Perhaps @moritz knows what is going on?

Member

leto commented Jan 1, 2012

Just as a datapoint, "parrot-nqp --target=past -e 1" works fine as of parrot RELEASE_3_11_0-5-g2006557 .

@KrisShannon : Which SHA1 of nqp.git did this happen to you on?

Also, "No method cache and no find_method method in meta-object" sounds like a deeper problem, although I agree that nqp should not fail like this. Perhaps @moritz knows what is going on?

@KrisShannon

This comment has been minimized.

Show comment
Hide comment
@KrisShannon

KrisShannon Jan 1, 2012

tag 2011.12 of nqp.git

Also current rakudo nom "perl6 --target=past -e 1" is dying with:

use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
===SORRY!===
Method '__dump' not found for invocant of class 'Any'

I'm trying to instrument it further to track it down.

tag 2011.12 of nqp.git

Also current rakudo nom "perl6 --target=past -e 1" is dying with:

use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
use of uninitialized value of type Mu in string context
===SORRY!===
Method '__dump' not found for invocant of class 'Any'

I'm trying to instrument it further to track it down.

@KrisShannon

This comment has been minimized.

Show comment
Hide comment
@KrisShannon

KrisShannon Jan 1, 2012

OK, The find_method in sixmodel seems to throw exceptions rather than return nulls for missing methods.

I guess that the real fix would be a custom 'can' VTABLE method which traps exceptions and returns false.

Unfortunately that's a bit beyond me at the moment. Not sure how to catch exceptions from a C function.

OK, The find_method in sixmodel seems to throw exceptions rather than return nulls for missing methods.

I guess that the real fix would be a custom 'can' VTABLE method which traps exceptions and returns false.

Unfortunately that's a bit beyond me at the moment. Not sure how to catch exceptions from a C function.

@KrisShannon

This comment has been minimized.

Show comment
Hide comment
@KrisShannon

KrisShannon Jan 1, 2012

I've made a patch to perl6/nqp#25 to add a specialized can VTABLE for sixmodel objects.

I still think something here is a good idea, possibly something which catches exceptions thrown during the __dump call as well - maybe dumping the exception as best as possible and then continuing.

You use a dumper like this when your doing some kind of debugging and the general murphy's rule with debugging is the missing information is the bit you need to track down the bug :)

I've made a patch to perl6/nqp#25 to add a specialized can VTABLE for sixmodel objects.

I still think something here is a good idea, possibly something which catches exceptions thrown during the __dump call as well - maybe dumping the exception as best as possible and then continuing.

You use a dumper like this when your doing some kind of debugging and the general murphy's rule with debugging is the missing information is the bit you need to track down the bug :)

@KrisShannon KrisShannon referenced this pull request in perl6/nqp Jan 1, 2012

Merged

Catch exceptions in VTABLE find_method #25

@leto

This comment has been minimized.

Show comment
Hide comment
@leto

leto Jan 1, 2012

Member

I agree with @KrisShannon in that we should have guards here, "just in case", but I wanted to make sure the deeper problems were also being fixed.

I am unsure exactly how to test this pull request. Does it depend on perl6/nqp#25 ? Which branch/commit of Rakudo ?

Member

leto commented Jan 1, 2012

I agree with @KrisShannon in that we should have guards here, "just in case", but I wanted to make sure the deeper problems were also being fixed.

I am unsure exactly how to test this pull request. Does it depend on perl6/nqp#25 ? Which branch/commit of Rakudo ?

@KrisShannon

This comment has been minimized.

Show comment
Hide comment
@KrisShannon

KrisShannon Jan 2, 2012

I'm thinking I will improve this to catch exceptions from both the can "__dump", and the actual method call itself and dump appropriate error text to show that it caught an exception.

I'll add some tests as well to demonstrate it in action.

I'm thinking I will improve this to catch exceptions from both the can "__dump", and the actual method call itself and dump appropriate error text to show that it caught an exception.

I'll add some tests as well to demonstrate it in action.

@leto

This comment has been minimized.

Show comment
Hide comment
@leto

leto Jan 2, 2012

Member

+1

Member

leto commented Jan 2, 2012

+1

@leto

This comment has been minimized.

Show comment
Hide comment
@leto

leto Feb 1, 2012

Member

@KrisShannon any progress on this?

Member

leto commented Feb 1, 2012

@KrisShannon any progress on this?

@zhuomingliang

This comment has been minimized.

Show comment
Hide comment
@zhuomingliang

zhuomingliang Mar 12, 2013

Contributor

Closed, because nqp --target=ast -e 1 works well now.

Contributor

zhuomingliang commented Mar 12, 2013

Closed, because nqp --target=ast -e 1 works well now.

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