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

B::Deparse bug on OS X #13846

Closed
p5pRT opened this issue May 15, 2014 · 23 comments
Closed

B::Deparse bug on OS X #13846

p5pRT opened this issue May 15, 2014 · 23 comments

Comments

@p5pRT
Copy link

p5pRT commented May 15, 2014

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

Searchable as RT121883$

@p5pRT
Copy link
Author

p5pRT commented May 15, 2014

From bsi@hosember.hu

I'm using Storable freeze/thaw to pass data structures (mostly hashes and arrays) between the main thread and a background worker thread in my Perl application under OS X. Sometimes I also pass simple CODE blocks between these threads which works under Win32 well but fails miserably under OS X.

I've found a workaround to my problem by patching B​::Deparse to skip @​ns elements in populate_curcvlex() if the element's class is NULL.

The workaround (diff) is attached for Perl 5.18.2

@p5pRT
Copy link
Author

p5pRT commented May 15, 2014

From bsi@hosember.hu

B-Deparse.diff

@p5pRT
Copy link
Author

p5pRT commented May 17, 2014

From @jkeenan

On Thu May 15 09​:53​:38 2014, bsi@​hosember.hu wrote​:

I'm using Storable freeze/thaw to pass data structures (mostly hashes
and arrays) between the main thread and a background worker thread in
my Perl application under OS X. Sometimes I also pass simple CODE
blocks between these threads which works under Win32 well but fails
miserably under OS X.

I've found a workaround to my problem by patching B​::Deparse to skip
@​ns elements in populate_curcvlex() if the element's class is NULL.

The workaround (diff) is attached for Perl 5.18.2

Would you be able to provide a short program which illustrates the problem and which we could then turn into a test file?

Lacking that, we would not be in a good position to evaluate the merits of your patch.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented May 17, 2014

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

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

It wasn't easy to create an appropriate and short test code but eventually I did it. See the attached B_Deparse_test.pl which illustrates the problem.

To be able to reproduce it you have to load a package which depends on package 'B'. In my real-world code I use JSON​::PP but to illustrate the problem I've replaced it with DummyPackage.pm which simply loads 'B' exactly like JSON​::PP.

The other premise is that you have to use DIE signal handlers locally in the freezable sub, therefore I've added local $SIG{__DIE__}.

Also during the testing it turned out that the problem is not OS X based, it also exists under Win32 too. What misleaded me earlier is that I used JSON XS under Windows and JSON PP under OS X.

Please let me know if I could help anything else.

Regards,
Barnabas Bona

On Sat May 17 09​:04​:03 2014, jkeenan wrote​:

On Thu May 15 09​:53​:38 2014, bsi@​hosember.hu wrote​:

I'm using Storable freeze/thaw to pass data structures (mostly hashes
and arrays) between the main thread and a background worker thread in
my Perl application under OS X. Sometimes I also pass simple CODE
blocks between these threads which works under Win32 well but fails
miserably under OS X.

I've found a workaround to my problem by patching B​::Deparse to skip
@​ns elements in populate_curcvlex() if the element's class is NULL.

The workaround (diff) is attached for Perl 5.18.2

Would you be able to provide a short program which illustrates the
problem and which we could then turn into a test file?

Lacking that, we would not be in a good position to evaluate the
merits of your patch.

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

B_Deparse_test.pl

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

DummyPackage.pm

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @jkeenan

On Mon Jun 02 04​:42​:12 2014, bsi@​hosember.hu wrote​:

It wasn't easy to create an appropriate and short test code but
eventually I did it. See the attached B_Deparse_test.pl which
illustrates the problem.

To be able to reproduce it you have to load a package which depends on
package 'B'. In my real-world code I use JSON​::PP but to illustrate
the problem I've replaced it with DummyPackage.pm which simply loads
'B' exactly like JSON​::PP.

The other premise is that you have to use DIE signal handlers locally
in the freezable sub, therefore I've added local $SIG{__DIE__}.

Also during the testing it turned out that the problem is not OS X
based, it also exists under Win32 too. What misleaded me earlier is
that I used JSON XS under Windows and JSON PP under OS X.

Please let me know if I could help anything else.

Regards,
Barnabas Bona

Can you attach (a) the failure output you get when running this program; and (b) the output of 'perl -V'?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

Sure, attached.

On Mon Jun 02 05​:42​:35 2014, jkeenan wrote​:

On Mon Jun 02 04​:42​:12 2014, bsi@​hosember.hu wrote​:

It wasn't easy to create an appropriate and short test code but
eventually I did it. See the attached B_Deparse_test.pl which
illustrates the problem.

To be able to reproduce it you have to load a package which depends
on
package 'B'. In my real-world code I use JSON​::PP but to illustrate
the problem I've replaced it with DummyPackage.pm which simply loads
'B' exactly like JSON​::PP.

The other premise is that you have to use DIE signal handlers locally
in the freezable sub, therefore I've added local $SIG{__DIE__}.

Also during the testing it turned out that the problem is not OS X
based, it also exists under Win32 too. What misleaded me earlier is
that I used JSON XS under Windows and JSON PP under OS X.

Please let me know if I could help anything else.

Regards,
Barnabas Bona

Can you attach (a) the failure output you get when running this
program; and (b) the output of 'perl -V'?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

Name "Storable​::Deparse" used only once​: possible typo at B_Deparse_test.pl line 9.
Name "Storable​::Eval" used only once​: possible typo at B_Deparse_test.pl line 10.
DIE called​: Can't locate object method "PVX" via package "B​::NULL" at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1502.
at B_Deparse_test.pl line 12 thread 1.
  main​::__ANON__('Can\'t locate object method "PVX" via package "B​::NULL" at /U...') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1502 thread 1
  B​::Deparse​::populate_curcvlex('B​::Deparse=HASH(0x1011e7cf0)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1475 thread 1
  B​::Deparse​::lex_in_scope('B​::Deparse=HASH(0x1011e7cf0)', '%SIG') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1461 thread 1
  B​::Deparse​::maybe_qualify('B​::Deparse=HASH(0x1011e7cf0)', '%', 'SIG') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1446 thread 1
  B​::Deparse​::stash_variable_name('B​::Deparse=HASH(0x1011e7cf0)', '%', 'B​::GV=SCALAR(0x10088e038)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 3448 thread 1
  B​::Deparse​::elem_or_slice_array_name('B​::Deparse=HASH(0x1011e7cf0)', 'B​::PADOP=SCALAR(0x10088de88)', '{', 'padhv', 1) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 3512 thread 1
  B​::Deparse​::elem('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082de88)', 7, '{', '}', 'padhv') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 3525 thread 1
  B​::Deparse​::pp_helem('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082de88)', 7) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 954 thread 1
  B​::Deparse​::deparse('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082de88)', 7) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 2407 thread 1
  B​::Deparse​::deparse_binop_left('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082dd50)', 'B​::BINOP=SCALAR(0x10082de88)', 7) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 2457 thread 1
  B​::Deparse​::binop('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082dd50)', 0.5, '=', 7, 1) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 2505 thread 1
  B​::Deparse​::pp_sassign('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082dd50)', 0.5) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 954 thread 1
  B​::Deparse​::deparse('B​::Deparse=HASH(0x1011e7cf0)', 'B​::BINOP=SCALAR(0x10082dd50)', 0.5) called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1374 thread 1
  B​::Deparse​::walk_lineseq('B​::Deparse=HASH(0x1011e7cf0)', undef, 'ARRAY(0x1008d24b8)', 'CODE(0x10082dd80)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1283 thread 1
  B​::Deparse​::lineseq('B​::Deparse=HASH(0x1011e7cf0)', undef, 0, 'B​::COP=SCALAR(0x1008344b8)', 'B​::BINOP=SCALAR(0x10082dd50)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1017 thread 1
  B​::Deparse​::deparse_sub('B​::Deparse=HASH(0x1011e7cf0)', 'B​::CV=SCALAR(0x100b6f4d0)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 825 thread 1
  B​::Deparse​::coderef2text('B​::Deparse=HASH(0x1011e7cf0)', 'CODE(0x10119cb58)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 339 thread 1
  eval {...} called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 339 thread 1
  Storable​::_freeze('CODE(0x101193d48)', 'CODE(0x10119cb58)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 318 thread 1
  Storable​::freeze('CODE(0x10119cb58)') called at B_Deparse_test.pl line 16 thread 1
  main​::__ANON__(undef) called at B_Deparse_test.pl line 17 thread 1
  eval {...} called at B_Deparse_test.pl line 17 thread 1
1DIE called​: Can't locate object method "PVX" via package "B​::NULL" at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1502, at B_Deparse_test.pl line 16 thread 1.
at B_Deparse_test.pl line 12 thread 1.
  main​::__ANON__('Can\'t locate object method "PVX" via package "B​::NULL" at /U...') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/Carp.pm line 100 thread 1
  Carp​::croak('Can\'t locate object method "PVX" via package "B​::NULL" at /U...') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 37 thread 1
  Storable​::__ANON__('Can\'t locate object method "PVX" via package "B​::NULL" at /U...') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 340 thread 1
  Storable​::_freeze('CODE(0x101193d48)', 'CODE(0x10119cb58)') called at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level/Storable.pm line 318 thread 1
  Storable​::freeze('CODE(0x10119cb58)') called at B_Deparse_test.pl line 16 thread 1
  main​::__ANON__(undef) called at B_Deparse_test.pl line 17 thread 1
  eval {...} called at B_Deparse_test.pl line 17 thread 1
1Thread 1 terminated abnormally​: Can't locate object method "PVX" via package "B​::NULL" at /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/B/Deparse.pm line 1502, at B_Deparse_test.pl line 16 thread 1.

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From bsi@hosember.hu

Summary of my perl5 (revision 5 version 18 subversion 2) configuration​:
 
  Platform​:
  osname=darwin, osvers=13.1.0, archname=darwin-thread-multi-2level
  uname='darwin bsimac.local 13.1.0 darwin kernel version 13.1.0​: wed apr 2 23​:52​:02 pdt 2014; root​:xnu-2422.92.1~2release_x86_64 x86_64 '
  config_args='-de -Dprefix=/Users/bsi/perl5/perlbrew/perls/perl-5.18.2 -Dusethreads -Accflags=-mmacosx-version-min=10.5 -Aldflags=-mmacosx-version-min=10.5 -Alddlflags=-mmacosx-version-min=10.5 -Aeval​:scriptdir=/Users/bsi/perl5/perlbrew/perls/perl-5.18.2/bin'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.5 -fno-strict-aliasing -pipe -fstack-protector',
  optimize='-O3',
  cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.5 -fno-strict-aliasing -pipe -fstack-protector'
  ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -mmacosx-version-min=10.5 -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -mmacosx-version-min=10.5 -L/usr/local/lib -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_PRESERVE_IVUV PERL_SAWAMPERSAND 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
  Built under darwin
  Compiled at Apr 26 2014 15​:29​:51
  %ENV​:
  PERLBREW_BASHRC_VERSION="0.67"
  PERLBREW_HOME="/Users/bsi/.perlbrew"
  PERLBREW_MANPATH="/Users/bsi/perl5/perlbrew/perls/perl-5.18.2/man"
  PERLBREW_PATH="/Users/bsi/perl5/perlbrew/bin​:/Users/bsi/perl5/perlbrew/perls/perl-5.18.2/bin"
  PERLBREW_PERL="perl-5.18.2"
  PERLBREW_ROOT="/Users/bsi/perl5/perlbrew"
  PERLBREW_VERSION="0.67"
  @​INC​:
  /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/darwin-thread-multi-2level
  /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2
  /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/darwin-thread-multi-2level
  /Users/bsi/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2
  .

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @rurban

I can confirm that this patch looks correct, but I don't fully understand it yet and
I'm not able to reproduce it yet.

I also had to protect new 5.18 padlists from being B​::NULL in B​::C,
where I run a full core testsuite and more.
I do not know why he had to check the namepad for NULL.

For me I got a NULL padlist with old code and IO​::Compress​::Gzip​::getExtraParams.
commit 0f11fe47 in B​::C
--
Reini Urban

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @jkeenan

I got remarkably similar output running on Linux x86_64. So this problem is definitely not specific to OS X.

Error output and perl configuration attached.

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @jkeenan

Summary of my perl5 (revision 5 version 21 subversion 1) configuration​:
  Commit id​: 0c2c57a
  Platform​:
  osname=linux, osvers=3.13.0-27-generic, archname=x86_64-linux-thread-multi
  uname='linux zareason 3.13.0-27-generic #50-ubuntu smp thu may 15 18​:06​:16 utc 2014 x86_64 x86_64 x86_64 gnulinux '
  config_args='-des -Dusedevel -Dusethreads'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.8.2', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
  libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.19'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -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_USE_DEVEL 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
  Built under linux
  Compiled at Jun 2 2014 08​:36​:38
  %ENV​:
  PERL5LIB="/home/jkeenan/perl5/lib/perl5"
  PERLBREW_BASHRC_VERSION="0.67"
  PERLBREW_HOME="/home/jkeenan/.perlbrew"
  PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.20.0/man"
  PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin​:/home/jkeenan/perl5/perlbrew/perls/perl-5.20.0/bin"
  PERLBREW_PERL="perl-5.20.0"
  PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew"
  PERLBREW_VERSION="0.67"
  PERL_LOCAL_LIB_ROOT="/home/jkeenan/perl5"
  PERL_MB_OPT="--install_base "/home/jkeenan/perl5""
  PERL_MM_OPT="INSTALL_BASE=/home/jkeenan/perl5"
  PERL_WORKDIR="gitwork/perl"
  @​INC​:
  lib
  /home/jkeenan/perl5/lib/perl5
  /usr/local/lib/perl5/site_perl/5.21.1/x86_64-linux-thread-multi
  /usr/local/lib/perl5/site_perl/5.21.1
  /usr/local/lib/perl5/5.21.1/x86_64-linux-thread-multi
  /usr/local/lib/perl5/5.21.1
  .

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @jkeenan

On Mon Jun 02 06​:58​:32 2014, jkeenan wrote​:

I got remarkably similar output running on Linux x86_64. So this
problem is definitely not specific to OS X.

Error output and perl configuration attached.

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @jkeenan

$ ./perl -Ilib -I/home/jkeenan/learn/perl/p5p ~/learn/perl/p5p/121883-B_Deparse_test.pl
Name "Storable​::Eval" used only once​: possible typo at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 11.
Name "Storable​::Deparse" used only once​: possible typo at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 10.
DIE called​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512.
at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 13 thread 1.
  main​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/B/Deparse.pm line 1512 thread 1
  B​::Deparse​::populate_curcvlex(B​::Deparse=HASH(0x2552930)) called at lib/B/Deparse.pm line 1485 thread 1
  B​::Deparse​::lex_in_scope(B​::Deparse=HASH(0x2552930), "%SIG") called at lib/B/Deparse.pm line 1471 thread 1
  B​::Deparse​::maybe_qualify(B​::Deparse=HASH(0x2552930), "%", "SIG") called at lib/B/Deparse.pm line 1456 thread 1
  B​::Deparse​::stash_variable_name(B​::Deparse=HASH(0x2552930), "%", B​::GV=SCALAR(0x7f671c373ff0)) called at lib/B/Deparse.pm line 3473 thread 1
  B​::Deparse​::elem_or_slice_array_name(B​::Deparse=HASH(0x2552930), B​::PADOP=SCALAR(0x7f671c35a9c8), "{", "padhv", 1) called at lib/B/Deparse.pm line 3537 thread 1
  B​::Deparse​::elem(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7, "{", "}", "padhv") called at lib/B/Deparse.pm line 3552 thread 1
  B​::Deparse​::pp_helem(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 961 thread 1
  B​::Deparse​::deparse(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 2416 thread 1
  B​::Deparse​::deparse_binop_left(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 2466 thread 1
  B​::Deparse​::binop(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5, "=", 7, 1) called at lib/B/Deparse.pm line 2514 thread 1
  B​::Deparse​::pp_sassign(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5) called at lib/B/Deparse.pm line 961 thread 1
  B​::Deparse​::deparse(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5) called at lib/B/Deparse.pm line 1384 thread 1
  B​::Deparse​::walk_lineseq(B​::Deparse=HASH(0x2552930), undef, ARRAY(0x7f671c0c7b28), CODE(0x7f671c38a4e8)) called at lib/B/Deparse.pm line 1293 thread 1
  B​::Deparse​::lineseq(B​::Deparse=HASH(0x2552930), undef, 0, B​::COP=SCALAR(0x7f671c01c108), B​::BINOP=SCALAR(0x7f671c34b808)) called at lib/B/Deparse.pm line 1027 thread 1
  B​::Deparse​::deparse_sub(B​::Deparse=HASH(0x2552930), B​::CV=SCALAR(0x7f671c45b408)) called at lib/B/Deparse.pm line 832 thread 1
  B​::Deparse​::coderef2text(B​::Deparse=HASH(0x2552930), CODE(0x2474710)) called at lib/Storable.pm line 340 thread 1
  eval {...} called at lib/Storable.pm line 340 thread 1
  Storable​::_freeze(CODE(0x2474380), CODE(0x2474710)) called at lib/Storable.pm line 319 thread 1
  Storable​::freeze(CODE(0x2474710)) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1
  main​::__ANON__(undef) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
  eval {...} called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
1DIE called​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512, at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1.
at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 13 thread 1.
  main​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Carp.pm line 166 thread 1
  Carp​::croak("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Storable.pm line 38 thread 1
  Storable​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Storable.pm line 341 thread 1
  Storable​::_freeze(CODE(0x2474380), CODE(0x2474710)) called at lib/Storable.pm line 319 thread 1
  Storable​::freeze(CODE(0x2474710)) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1
  main​::__ANON__(undef) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
  eval {...} called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
1Thread 1 terminated abnormally​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512, at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1.

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2014

From @rurban

See also http​://grokbase.com/t/perl/perl5-porters/13ayhsd2d9/padlist-null-pointer
but this was a Coro.xs bug and we only use threads, no Coro.

On Mon, Jun 2, 2014 at 8​:59 AM, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Mon Jun 02 06​:58​:32 2014, jkeenan wrote​:

I got remarkably similar output running on Linux x86_64. So this
problem is definitely not specific to OS X.

Error output and perl configuration attached.

---
via perlbug​: queue​: perl5 status​: open
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=121883

$ ./perl -Ilib -I/home/jkeenan/learn/perl/p5p ~/learn/perl/p5p/121883-B_Deparse_test.pl
Name "Storable​::Eval" used only once​: possible typo at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 11.
Name "Storable​::Deparse" used only once​: possible typo at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 10.
DIE called​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512.
at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 13 thread 1.
main​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/B/Deparse.pm line 1512 thread 1
B​::Deparse​::populate_curcvlex(B​::Deparse=HASH(0x2552930)) called at lib/B/Deparse.pm line 1485 thread 1
B​::Deparse​::lex_in_scope(B​::Deparse=HASH(0x2552930), "%SIG") called at lib/B/Deparse.pm line 1471 thread 1
B​::Deparse​::maybe_qualify(B​::Deparse=HASH(0x2552930), "%", "SIG") called at lib/B/Deparse.pm line 1456 thread 1
B​::Deparse​::stash_variable_name(B​::Deparse=HASH(0x2552930), "%", B​::GV=SCALAR(0x7f671c373ff0)) called at lib/B/Deparse.pm line 3473 thread 1
B​::Deparse​::elem_or_slice_array_name(B​::Deparse=HASH(0x2552930), B​::PADOP=SCALAR(0x7f671c35a9c8), "{", "padhv", 1) called at lib/B/Deparse.pm line 3537 thread 1
B​::Deparse​::elem(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7, "{", "}", "padhv") called at lib/B/Deparse.pm line 3552 thread 1
B​::Deparse​::pp_helem(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 961 thread 1
B​::Deparse​::deparse(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 2416 thread 1
B​::Deparse​::deparse_binop_left(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), B​::BINOP=SCALAR(0x7f671c359e70), 7) called at lib/B/Deparse.pm line 2466 thread 1
B​::Deparse​::binop(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5, "=", 7, 1) called at lib/B/Deparse.pm line 2514 thread 1
B​::Deparse​::pp_sassign(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5) called at lib/B/Deparse.pm line 961 thread 1
B​::Deparse​::deparse(B​::Deparse=HASH(0x2552930), B​::BINOP=SCALAR(0x7f671c34b808), 0.5) called at lib/B/Deparse.pm line 1384 thread 1
B​::Deparse​::walk_lineseq(B​::Deparse=HASH(0x2552930), undef, ARRAY(0x7f671c0c7b28), CODE(0x7f671c38a4e8)) called at lib/B/Deparse.pm line 1293 thread 1
B​::Deparse​::lineseq(B​::Deparse=HASH(0x2552930), undef, 0, B​::COP=SCALAR(0x7f671c01c108), B​::BINOP=SCALAR(0x7f671c34b808)) called at lib/B/Deparse.pm line 1027 thread 1
B​::Deparse​::deparse_sub(B​::Deparse=HASH(0x2552930), B​::CV=SCALAR(0x7f671c45b408)) called at lib/B/Deparse.pm line 832 thread 1
B​::Deparse​::coderef2text(B​::Deparse=HASH(0x2552930), CODE(0x2474710)) called at lib/Storable.pm line 340 thread 1
eval {...} called at lib/Storable.pm line 340 thread 1
Storable​::_freeze(CODE(0x2474380), CODE(0x2474710)) called at lib/Storable.pm line 319 thread 1
Storable​::freeze(CODE(0x2474710)) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1
main​::__ANON__(undef) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
eval {...} called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
1DIE called​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512, at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1.
at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 13 thread 1.
main​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Carp.pm line 166 thread 1
Carp​::croak("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Storable.pm line 38 thread 1
Storable​::__ANON__("Can't locate object method \"PVX\" via package \"B​::NULL\" at lib"...) called at lib/Storable.pm line 341 thread 1
Storable​::_freeze(CODE(0x2474380), CODE(0x2474710)) called at lib/Storable.pm line 319 thread 1
Storable​::freeze(CODE(0x2474710)) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1
main​::__ANON__(undef) called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
eval {...} called at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 18 thread 1
1Thread 1 terminated abnormally​: Can't locate object method "PVX" via package "B​::NULL" at lib/B/Deparse.pm line 1512, at /home/jkeenan/learn/perl/p5p/121883-B_Deparse_test.pl line 17 thread 1.

--
Reini Urban
http​://cpanel.net/ http​://www.perl-compiler.org/

@p5pRT
Copy link
Author

p5pRT commented Jun 18, 2014

From @tonycoz

On Sat May 17 09​:04​:03 2014, jkeenan wrote​:

On Thu May 15 09​:53​:38 2014, bsi@​hosember.hu wrote​:

I'm using Storable freeze/thaw to pass data structures (mostly hashes
and arrays) between the main thread and a background worker thread in
my Perl application under OS X. Sometimes I also pass simple CODE
blocks between these threads which works under Win32 well but fails
miserably under OS X.

I've found a workaround to my problem by patching B​::Deparse to skip
@​ns elements in populate_curcvlex() if the element's class is NULL.

The workaround (diff) is attached for Perl 5.18.2

Would you be able to provide a short program which illustrates the
problem and which we could then turn into a test file?

Here's a short reproducer​:

./perl -Ilib -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @iabyn

On Tue, Jun 17, 2014 at 11​:20​:02PM -0700, Tony Cook via RT wrote​:

Here's a short reproducer​:

./perl -Ilib -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'

This appears to have been fixed sometime between 5.21.6 and 5.21.7​:

$ perl5216t -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'
Thread 1 terminated abnormally​: Can't locate object method "PVX" via package "B​::NULL" at /home/davem/perl5/a/perl-5.21.6t.out/lib/5.21.6/B/Deparse.pm line 1579.

$ perl5217t -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'
$

--
More than any other time in history, mankind faces a crossroads. One path
leads to despair and utter hopelessness. The other, to total extinction.
Let us pray we have the wisdom to choose correctly.
  -- Woody Allen

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @wolfsage

On Thu, Mar 26, 2015 at 9​:40 AM, Dave Mitchell <davem@​iabyn.com> wrote​:

On Tue, Jun 17, 2014 at 11​:20​:02PM -0700, Tony Cook via RT wrote​:

Here's a short reproducer​:

./perl -Ilib -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'

This appears to have been fixed sometime between 5.21.6 and 5.21.7​:

$ perl5216t -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'
Thread 1 terminated abnormally​: Can't locate object method "PVX" via package "B​::NULL" at /home/davem/perl5/a/perl-5.21.6t.out/lib/5.21.6/B/Deparse.pm line 1579.

$ perl5217t -Mthreads -MB​::Deparse -le '$d = B​::Deparse->new(); sub foo { local @​x; }; $t = threads->create(sub {$x = $d->coderef2text(\&foo) }); $t->join'
$

According to a bisect, fixed by one of​:

  a2ddd1d
  39899bf
  3e020df
  0132693
  863f222
  b19cb98
  dbfcda0
  0f94cb1

But many of these couldn't be compiled until the final commit. (Also
note that the sort order is wrong above but these are all continuous).

These were various updates of the form​:

  commit 3e020df
  Author​: Father Chrysostomos <sprout@​cpan.org>
  Date​: Thu Nov 27 22​:14​:39 2014 -0800

  Use PADNAME rather than SV in pad.c​:padlist_dup

-- Matthew Horsfall (alh)

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

@iabyn - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

From @khwilliamson

Thanks for submitting this ticket

The issue should be resolved with the release today of Perl v5.22. If you find that the problem persists, feel free to reopen this ticket

--
Karl Williamson for the Perl 5 porters team

@p5pRT
Copy link
Author

p5pRT commented Jun 2, 2015

@khwilliamson - Status changed from 'pending release' to 'resolved'

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

No branches or pull requests

1 participant