cmv has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks-

I believe I'm seeing an issue with ActiveState Perl 5.20 (for MacOSX) that causes "perl -c" to crash. The same script seems to work fine with an older ActiveState Perl (5.14) I have from a while ago.

Is this a Perl thing, or Tk thing, or POE thing (or combination)?

Can others verify they see the same thing?

I don't know how to debug this from here.

Any help is greatly appreciated!

Thanks

-Craig

Simple Perl Script (mactst.pl)

use warnings; use strict; use Tk; use POE; if(! defined($poe_main_window)) { warn "\$poe_main_window not defined" + };

Working Command

$ /usr/local/ActivePerl-5.14/bin/perl -c mactst.pl mactst.pl syntax OK Free non-Callback 1011f4aa0 RV=0 during global destruction. $

Failing Command

$ /usr/local/ActivePerl-5.20/bin/perl -c mactst.pl mactst.pl syntax OK . (1): 0 0x10170c998 IV f=00000001 undef(1) SV = IV(0x10170c988) at 0x10170c998 REFCNT = 1 FLAGS = () IV = 0 Abort $

Replies are listed 'Best First'.
Re: Crashing perl -c in version 5.20? (magic)
by tye (Sage) on Jan 06, 2016 at 08:13 UTC

    Your "Working command" demonstrates a fairly serious problem that could be, for example, memory corruption:

    Free non-Callback 1011f4aa0 RV=0 during global destruction.

    So I'm not terribly shocked to have such a problem manifest somewhat differently under a different set of versions of components.

    Which points the finger at your problem being in Tk and/or POE, not Perl. It could be a bug in Tk that gets exposed by something POE does. Or vice versa.

    It could even be not a bug in Tk or POE, but just that Tk makes some too-bold assumptions that just conflict with some too-bold assumptions that POE makes. Put another way, it could just be that Tk and POE are incompatible. They might be only somewhat incompatible such that they can work together in a lot of cases but not all.

    It is my experience that Perl modules that use much XS code are much more likely to have these kinds of problems than non-XS modules or Perl. So I'd bet money that Tk is the most to blame.

    I've usually been able to get around such problems at least for a while, by switching to a different version of the XS-using module. Even better is to switch to a module that does not use as much XS code. That would mean using a graphics system other than Tk, of course. And XS code is probably common in most if not all GUI modules. But the bugs and/or sensitivities are likely to be different enough to give you a good chance of not running into problems, at least for a while.

    - tye        

      Hi tye++

      Many thanks for the thoughtful response. What you say makes sense, and I will follow-up with Rocco Caputo (POE) and Slaven Rezic (Tk) to see if we can figure out this issue.

      BTW: I was able to eliminate the "Free non-Callback" problem by changing the use POE command to be use POE qw (Loop::TkActiveState);

      Here is the latest version & output...

      mactst.pl:

      use warnings; use strict; use Tk; use POE qw (Loop::TkActiveState); if(! defined($poe_main_window)) { warn "\$poe_main_window not defined"; }
      Working command:
      $ /usr/local/ActivePerl-5.14/bin/perl -c mactst.pl mactst.pl syntax OK
      Non-working command:
      $ /usr/local/ActivePerl-5.20/bin/perl -c mactst.pl mactst.pl syntax OK . (1): 0 0x1030c4968 IV f=00000001 undef(1) SV = IV(0x1030c4958) at 0x1030c4968 REFCNT = 1 FLAGS = () IV = 0 Abort
Re: Crashing perl -c in version 5.20?
by karlgoethebier (Abbot) on Jan 05, 2016 at 21:02 UTC

    Perhaps this might help?

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Hi Karl-

      Thanks for the pointer. That was an old article I wrote back in 2009, for a similar issue I was having on windows. Sill is good advice though.

      However, adding all the "use POE::..." lines doesn't make any difference (you need to remove POE::Resource::Statistics, as it went away sometime before 5.20).

      Still getting the error.

Re: Crashing perl -c in version 5.20?
by 1nickt (Canon) on Jan 05, 2016 at 19:00 UTC

    Is this a Perl thing, or Tk thing, or POE thing (or combination)?

    Do you get the same results from perl -c when you don't load those modules?


    The way forward always starts with a minimal test.
      I seem to only be able to generate the error when both "use Tk" and "use POE" are in the script.

      Since the same script works fine in 5.14, it could be either 5.20, Tk, POE, or some combination of the three.

Re: Crashing perl -c in version 5.20?
by hotchiwawa (Scribe) on Jan 05, 2016 at 20:02 UTC
    Hi cmv :)

    I installed POE and checked on my mac with ActivePerl 5.20.2 (via PerlBrew):

    the compilation was OK and the execution gave me the expected error: $poe_main_window not defined at xx.pl line 9.
      Hi hotchiwawa

      The "not defined" error indicates that "use POE" didn't work correctly.

      After installing activeperl 5.20.2, you'll need to install both Tk and POE as well. You can do that using activestate's ppm command or get and build from CPAN.

      Once both POE and Tk are installed, you shouldn't see a "not defined" error, and I'm interested to know if you see the same crash as I do.

      Thanks

      -Craig

        after the syntax OK, I don't have "non callback...". TK was already installed and working. I posted TK codes some days ago. I think my perl version does not accept threads, I think I saw this cpan error when trying to install ExtUtils::PkgConfig.
Re: Crashing perl -c in version 5.20?
by Anonymous Monk on Jan 06, 2016 at 00:48 UTC
    What is the output of perl -V?
      Here is my perl -V output:
      Summary of my perl5 (revision 5 version 20 subversion 2) configuration +: Platform: osname=darwin, osvers=10.8.0, archname=darwin-thread-multi-2level uname='darwin neko 10.8.0 darwin kernel version 10.8.0: tue jun 7 +16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386 ' config_args='-ders -Dcc=gcc -Dusethreads -Duseithreads -Uinstallus +rbinperl -Ulocincpth= -Uloclibpth= -Duse64bitint -Ud_poll -Ui_poll -U +i_libutil -Aldflags=-Wl,-search_paths_first -Alddlflags=-Wl,-search_p +aths_first -Accflags=-arch x86_64 -Aldflags=-arch x86_64 -Alddlflags= +-arch x86_64 -Accflags=-DUSE_SITECUSTOMIZE -Duselargefiles -Accflags= +-DPERL_RELOCATABLE_INCPUSH -Dprefix=/usr/local/ActivePerl-5.20 -Dpriv +lib=/usr/local/ActivePerl-5.20/lib -Darchlib=/usr/local/ActivePerl-5. +20/lib -Dsiteprefix=/usr/local/ActivePerl-5.20/site -Dsitelib=/usr/lo +cal/ActivePerl-5.20/site/lib -Dsitearch=/usr/local/ActivePerl-5.20/si +te/lib -Dsed=/usr/bin/sed -Duseshrplib -Dcf_by=ActiveState -Dcf_email +=support@ActiveState.com' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='/usr/bin/gcc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-pre +comp -arch x86_64 -DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH -fno +-strict-aliasing -pipe -fstack-protector', optimize='-O3', cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precom +p -arch x86_64 -DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH -fno-st +rict-aliasing -pipe -fstack-protector' ccversion='', gccversion='Apple LLVM version 7.0.2 (clang-700.1.81 +)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc -mmacosx-version-min=10.5', ldflags =' -Wl,-search_paths_f +irst -arch x86_64 -fstack-protector' libpth=/usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -Wl, +-search_paths_first -arch x86_64 -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV PERL_RELOCATABLE_INCPUSH USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 2002 [299195] Built under darwin Compiled at Jul 19 2015 04:34:30 @INC: /Users/cmv/Library/ActivePerl-5.20/lib /usr/local/ActivePerl-5.20/site/lib /usr/local/ActivePerl-5.20/lib .
        What do you get with  perl -MDevel::VersionDump  -MTk -MPOE -e 1 ?