Ticket #537 (closed bug: invalid)

Opened 13 years ago

Last modified 10 years ago

Parrot::Interpreter - crash when calling new twice

Reported by: szabgab Owned by:
Priority: normal Milestone:
Component: none Version: trunk
Severity: medium Keywords:
Cc: jkeenan Language:
Patch status: Platform:

Description

If I call Parrot::Interpreter->new twice in the same script it gives me a crash that I cannot catch in perl.

Backtrace - Obtained 23 stack frames (max trace depth is 32).
  (unknown)
    Parrot_confess
      (unknown)
        Parrot_str_to_hashval
          (unknown)
            parrot_hash_put
              Parrot_Hash_set_pmc_keyed_str
                (unknown)
                  Parrot_NameSpace_set_pmc_keyed_str
                    register_raw_nci_method_in_ns
                      (unknown)
                        (unknown)
                          (unknown)
                            (unknown)
                              make_interpreter
                                Parrot_new
                                  XS_Parrot__Interpreter_new
                                    Perl_pp_entersub
                                      Perl_runops_standard
                                        perl_run
                                          main
                                            __libc_start_main
                                              (unknown)

As in Padre there might be several plugins that try to embed their own Parrot interpreter it would be nice at least we could catch this exception.

If Parrot::Interpreter is not planned to support multiple instances then probably better to turn it into a singleton.

Change History

in reply to: ↑ description   Changed 12 years ago by jkeenan

  • cc jkeenan added

Replying to szabgab:

If I call Parrot::Interpreter->new twice in the same script it gives me a crash that I cannot catch in perl.

I am not familiar with Parrot::Interpreter, but while reviewing old Trac tickets I came upon this one and decided to look at that package (ext/Parrot-Embed/lib/Parrot/Interpreter.pm). Its documentation says:

SYNOPSIS
               # the first interpreter created in the program
               my $interp       = Parrot::Interpreter->new();

               # all subsequent interpreters need a parent
               my $child_interp = $interp->new( $interp );

So it seems to be me that you should not be trying to call Parrot::Interpreter->new() twice in a program.

Whether this is a good design is, of course, debatable. But will your programs work if you create child interpreters?

Thank you very much.
kid51

  Changed 10 years ago by benabik

  • status changed from new to closed
  • resolution set to invalid

Parrot::Embed and Parrot::Interpreter have been removed from parrot. This ticket has been replaced with  https://github.com/parrot/parrot-embed/issues/1

Note: See TracTickets for help on using tickets.