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

Blead Breaks CPAN: BRUMMETT/Devel-hdb-0.23.tar.gz #16583

Closed
p5pRT opened this issue Jun 9, 2018 · 13 comments
Closed

Blead Breaks CPAN: BRUMMETT/Devel-hdb-0.23.tar.gz #16583

p5pRT opened this issue Jun 9, 2018 · 13 comments
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s)

Comments

@p5pRT
Copy link

p5pRT commented Jun 9, 2018

Migrated from rt.perl.org#133271 (status was 'open')

Searchable as RT133271$

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

From @eserte

This is a bug report for perl from slaven@​rezic.de,
generated with the help of perlbug 1.41 running under perl 5.28.0.


On FreeBSD systems (10 .. 12) the test
t/04-get-all-breakpoints.t is instable with newer perls​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23

Test failure looks like this​:

Can't get breakpoint​: Can't connect to 127.0.0.1​:44242 (Connection refused)# Looks like your test exited with 61 just after 6.
t/04-get-all-breakpoints.t ........
Dubious, test returned 61 (wstat 15616, 0x3d00)
Failed 7/13 subtests

Looking with truss into the test process one can see that
a segmentation fault happens (in a fork of the original
process)​:

49835​: 2.000253424 0.000032407 setitimer(0,{ 0.000000, 300.000000 },{ 0.000000, 0.000000 }) = 0 (0x0)
49835​: 2.000384725 0.000041625 write(3,"{"inactive"​:0,"line"​:"3","code"​:1,"filename"​:"t/TestNothing.pm","href"​:"/breakpoints/277381443ba5747d15dbc99b7c74d88a"}",119) = 119 (0x77)
49835​: 2.000504573 0.000032965 setitimer(0,{ 0.000000, 0.000000 },{ 0.000000, 299.999749 }) = 0 (0x0)
49835​: 2.000588383 0.000022350 sigprocmask(SIG_BLOCK,{ SIGALRM },{ }) = 0 (0x0)
49835​: 2.000674148 0.000022629 sigprocmask(SIG_SETMASK,{ SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGEMT|SIGFPE|SIGKILL|SIGBUS|SIGSEGV|SIGSYS|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2 },{ SIGALRM }) = 0 (0x0)
49835​: 2.000749856 0.000022350 sigaction(SIGALRM,{ SIG_DFL 0x0 ss_t },{ 0x80084a590 SA_SIGINFO ss_t }) = 0 (0x0)
49835​: 2.000824726 0.000021791 sigprocmask(SIG_SETMASK,{ SIGALRM },0x0) = 0 (0x0)
49835​: 2.000899595 0.000022069 sigprocmask(SIG_SETMASK,{ },0x0) = 0 (0x0)
49835​: 2.001040954 0.000043581 close(3) = 0 (0x0)
49835​: 2.001116103 0.000118730 SIGNAL 11 (SIGSEGV) code=SEGV_MAPERR trapno=12 addr=0x800000
49835​: 4.232705079 2.231707706 process killed, signal = 11 (core dumped)

The backtrace​:

#0 0x00000000004c4f57 in Perl_hfree_next_entry ()
#1 0x00000000004def61 in Perl_sv_clear ()
#2 0x00000000004df584 in Perl_sv_free2 ()
#3 0x00000000004ff079 in Perl_leave_scope ()
#4 0x000000000050706a in Perl_pp_leave ()
#5 0x00000000004c9183 in Perl_runops_standard ()
#6 0x0000000000446906 in S_run_body ()
#7 0x000000000044670c in perl_run ()
#8 0x0000000000423e7d in main ()

I found also a CPAN Testers report from a linux system with
some memory corruption (here it's 5.27.2)​:

http​://www.cpantesters.org/cpan/report/84842889

The problem seems also to happen with the latest devel version
of Devel-hdb​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23_14



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.28.0​:

Configured by eserte at Wed Jun 6 23​:52​:33 CEST 2018.

Summary of my perl5 (revision 5 version 28 subversion 0) configuration​:
 
  Platform​:
  osname=freebsd
  osvers=10.3-release-p24
  archname=amd64-freebsd
  uname='freebsd cvrsnica-freebsd-101.herceg.de 10.3-release-p24 freebsd 10.3-release-p24 #0​: wed nov 15 04​:57​:40 utc 2017 root@​amd64-builder.daemonology.net​:usrobjusrsrcsysgeneric amd64 '
  config_args='-ds -e -Dprefix=/usr/perl5.28.0-RC2p -Dcf_email=srezic@​cpan.org -Doptimize=-O2 -pipe'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_FORTIFY_SOURCE=2'
  optimize='-O2 -pipe'
  cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion=''
  gccversion='4.2.1 Compatible FreeBSD Clang 3.4.1 (tags/RELEASE_34/dot1-final 208032)'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags ='-pthread -Wl,-E -fstack-protector -L/usr/local/lib'
  libpth=/usr/lib /usr/local/lib /usr/include/clang/3.4.1 /usr/lib
  libs=-lpthread -lgdbm -lm -lcrypt -lutil -lc -lelf
  perllibs=-lpthread -lm -lcrypt -lutil -lc -lelf
  libc=
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags=' '
  cccdlflags='-DPIC -fPIC'
  lddlflags='-shared -L/usr/local/lib -fstack-protector'

Locally applied patches​:
  RC2


@​INC for perl 5.28.0​:
  /usr/perl5.28.0-RC2p/lib/site_perl/5.28.0/amd64-freebsd
  /usr/perl5.28.0-RC2p/lib/site_perl/5.28.0
  /usr/perl5.28.0-RC2p/lib/5.28.0/amd64-freebsd
  /usr/perl5.28.0-RC2p/lib/5.28.0


Environment for perl 5.28.0​:
  HOME=/home/eserte
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/local/bin​:/usr/bin​:/bin​:/usr/local/sbin​:/usr/sbin​:/sbin​:/home/eserte/bin/freebsd10.3​:/home/eserte/bin/sh​:/home/eserte/bin​:/home/eserte/bin/pistachio-perl/bin​:/usr/games​:/home/eserte/devel
  PERLDOC=-MPod​::Perldoc​::ToTextOverstrike
  PERL_BADLANG (unset)
  SHELL=/usr/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

From @jkeenan

On Sat, 09 Jun 2018 12​:55​:59 GMT, slaven@​rezic.de wrote​:

This is a bug report for perl from slaven@​rezic.de,
generated with the help of perlbug 1.41 running under perl 5.28.0.

-----------------------------------------------------------------
On FreeBSD systems (10 .. 12) the test
t/04-get-all-breakpoints.t is instable with newer perls​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23

Test failure looks like this​:

Can't get breakpoint​: Can't connect to 127.0.0.1​:44242 (Connection
refused)# Looks like your test exited with 61 just after 6.
t/04-get-all-breakpoints.t ........
Dubious, test returned 61 (wstat 15616, 0x3d00)
Failed 7/13 subtests

Looking with truss into the test process one can see that
a segmentation fault happens (in a fork of the original
process)​:

49835​: 2.000253424 0.000032407 setitimer(0,{ 0.000000, 300.000000 },{
0.000000, 0.000000 }) = 0 (0x0)
49835​: 2.000384725 0.000041625
write(3,"{"inactive"​:0,"line"​:"3","code"​:1,"filename"​:"t/TestNothing.pm","href"​:"/breakpoints/277381443ba5747d15dbc99b7c74d88a"}",119)
= 119 (0x77)
49835​: 2.000504573 0.000032965 setitimer(0,{ 0.000000, 0.000000 },{
0.000000, 299.999749 }) = 0 (0x0)
49835​: 2.000588383 0.000022350 sigprocmask(SIG_BLOCK,{ SIGALRM },{ })
= 0 (0x0)
49835​: 2.000674148 0.000022629 sigprocmask(SIG_SETMASK,{
SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGEMT|SIGFPE|SIGKILL|SIGBUS|SIGSEGV|SIGSYS|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2
},{ SIGALRM }) = 0 (0x0)
49835​: 2.000749856 0.000022350 sigaction(SIGALRM,{ SIG_DFL 0x0 ss_t
},{ 0x80084a590 SA_SIGINFO ss_t }) = 0 (0x0)
49835​: 2.000824726 0.000021791 sigprocmask(SIG_SETMASK,{ SIGALRM
},0x0) = 0 (0x0)
49835​: 2.000899595 0.000022069 sigprocmask(SIG_SETMASK,{ },0x0) = 0
(0x0)
49835​: 2.001040954 0.000043581 close(3) = 0 (0x0)
49835​: 2.001116103 0.000118730 SIGNAL 11 (SIGSEGV) code=SEGV_MAPERR
trapno=12 addr=0x800000
49835​: 4.232705079 2.231707706 process killed, signal = 11 (core
dumped)

The backtrace​:

#0 0x00000000004c4f57 in Perl_hfree_next_entry ()
#1 0x00000000004def61 in Perl_sv_clear ()
#2 0x00000000004df584 in Perl_sv_free2 ()
#3 0x00000000004ff079 in Perl_leave_scope ()
#4 0x000000000050706a in Perl_pp_leave ()
#5 0x00000000004c9183 in Perl_runops_standard ()
#6 0x0000000000446906 in S_run_body ()
#7 0x000000000044670c in perl_run ()
#8 0x0000000000423e7d in main ()

I found also a CPAN Testers report from a linux system with
some memory corruption (here it's 5.27.2)​:

http​://www.cpantesters.org/cpan/report/84842889

The problem seems also to happen with the latest devel version
of Devel-hdb​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23_14

I can reproduce this problem on FreeBSD-11.1 with a perl built from commit 64a9c78, which was committed to blead on May 11. See attachments.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

From @jkeenan

Can't get breakpoint​: Status read failed​: Connection reset by peer# Looks like your test exited with 54 just after 6.
t/04-get-all-breakpoints.t ..
1..13
# pid 10134
# running /usr/home/jkeenan/testing/blead/bin/perl -I t/../lib -d​:hdb=testharness,listenfd​:4 /tmp/devel-hdb-test-Xv9z
ok 1 - Request stack position
ok 2 - Stopped on line 3
ok 3 - Set breakpoint for line 3
ok 4 - Set breakpoint for line 4
ok 5 - Set breakpoint line 5
ok 6 - Set breakpoint for line TestNothing.pm 3
# Killing pid 10134
Dubious, test returned 54 (wstat 13824, 0x3600)
Failed 7/13 subtests

Test Summary Report


t/04-get-all-breakpoints.t (Wstat​: 13824 Tests​: 6 Failed​: 0)
  Non-zero exit status​: 54
  Parse errors​: Bad plan. You planned 13 tests but ran 6.
Files=1, Tests=6, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.18 cusr 0.02 csys = 0.21 CPU)
Result​: FAIL

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

From @jkeenan

Summary of my perl5 (revision 5 version 28 subversion 0) configuration​:
  Commit id​: 64a9c78
  Platform​:
  osname=freebsd
  osvers=11.1-release-p9
  archname=amd64-freebsd
  uname='freebsd kid51-freebsd-11-install-3 11.1-release-p9 freebsd 11.1-release-p9 #0​: tue apr 3 16​:59​:16 utc 2018 root@​amd64-builder.daemonology.net​:usrobjusrsrcsysgeneric amd64 '
  config_args='-des -Dusedevel -Uversiononly -Dprefix=/home/jkeenan/testing/blead -Dman1dir=none -Dman3dir=none'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_FORTIFY_SOURCE=2'
  optimize='-O2'
  cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
  ccversion=''
  gccversion='4.2.1 Compatible FreeBSD Clang 4.0.0 (tags/RELEASE_400/final 297347)'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags ='-Wl,-E -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/lib /usr/local/lib /usr/bin/../lib/clang/4.0.0/lib /usr/lib
  libs=-lpthread -lgdbm -lm -lcrypt -lutil -lc
  perllibs=-lpthread -lm -lcrypt -lutil -lc
  libc=
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags=' '
  cccdlflags='-DPIC -fPIC'
  lddlflags='-shared -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  Built under freebsd
  Compiled at May 15 2018 13​:18​:03
  %ENV​:
  PERL2DIR="/home/jkeenan/gitwork/perl2"
  PERL_WORKDIR="/home/jkeenan/gitwork/perl"
  @​INC​:
  /home/jkeenan/testing/blead/lib
  /home/jkeenan/testing/blead/lib/perl5/site_perl/5.28.0/amd64-freebsd
  /home/jkeenan/testing/blead/lib/perl5/site_perl/5.28.0
  /home/jkeenan/testing/blead/lib/perl5/5.28.0/amd64-freebsd
  /home/jkeenan/testing/blead/lib/perl5/5.28.0

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

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

@p5pRT
Copy link
Author

p5pRT commented Jun 9, 2018

From @jkeenan

On Sat, 09 Jun 2018 13​:56​:16 GMT, jkeenan wrote​:

On Sat, 09 Jun 2018 12​:55​:59 GMT, slaven@​rezic.de wrote​:

This is a bug report for perl from slaven@​rezic.de,
generated with the help of perlbug 1.41 running under perl 5.28.0.

-----------------------------------------------------------------
On FreeBSD systems (10 .. 12) the test
t/04-get-all-breakpoints.t is instable with newer perls​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23

Test failure looks like this​:

Can't get breakpoint​: Can't connect to 127.0.0.1​:44242 (Connection
refused)# Looks like your test exited with 61 just after 6.
t/04-get-all-breakpoints.t ........
Dubious, test returned 61 (wstat 15616, 0x3d00)
Failed 7/13 subtests

Looking with truss into the test process one can see that
a segmentation fault happens (in a fork of the original
process)​:

49835​: 2.000253424 0.000032407 setitimer(0,{ 0.000000, 300.000000 },{
0.000000, 0.000000 }) = 0 (0x0)
49835​: 2.000384725 0.000041625
write(3,"{"inactive"​:0,"line"​:"3","code"​:1,"filename"​:"t/TestNothing.pm","href"​:"/breakpoints/277381443ba5747d15dbc99b7c74d88a"}",119)
= 119 (0x77)
49835​: 2.000504573 0.000032965 setitimer(0,{ 0.000000, 0.000000 },{
0.000000, 299.999749 }) = 0 (0x0)
49835​: 2.000588383 0.000022350 sigprocmask(SIG_BLOCK,{ SIGALRM },{ })
= 0 (0x0)
49835​: 2.000674148 0.000022629 sigprocmask(SIG_SETMASK,{
SIGHUP|SIGINT|SIGQUIT|SIGILL|SIGTRAP|SIGABRT|SIGEMT|SIGFPE|SIGKILL|SIGBUS|SIGSEGV|SIGSYS|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2
},{ SIGALRM }) = 0 (0x0)
49835​: 2.000749856 0.000022350 sigaction(SIGALRM,{ SIG_DFL 0x0 ss_t
},{ 0x80084a590 SA_SIGINFO ss_t }) = 0 (0x0)
49835​: 2.000824726 0.000021791 sigprocmask(SIG_SETMASK,{ SIGALRM
},0x0) = 0 (0x0)
49835​: 2.000899595 0.000022069 sigprocmask(SIG_SETMASK,{ },0x0) = 0
(0x0)
49835​: 2.001040954 0.000043581 close(3) = 0 (0x0)
49835​: 2.001116103 0.000118730 SIGNAL 11 (SIGSEGV) code=SEGV_MAPERR
trapno=12 addr=0x800000
49835​: 4.232705079 2.231707706 process killed, signal = 11 (core
dumped)

The backtrace​:

#0 0x00000000004c4f57 in Perl_hfree_next_entry ()
#1 0x00000000004def61 in Perl_sv_clear ()
#2 0x00000000004df584 in Perl_sv_free2 ()
#3 0x00000000004ff079 in Perl_leave_scope ()
#4 0x000000000050706a in Perl_pp_leave ()
#5 0x00000000004c9183 in Perl_runops_standard ()
#6 0x0000000000446906 in S_run_body ()
#7 0x000000000044670c in perl_run ()
#8 0x0000000000423e7d in main ()

I found also a CPAN Testers report from a linux system with
some memory corruption (here it's 5.27.2)​:

http​://www.cpantesters.org/cpan/report/84842889

The problem seems also to happen with the latest devel version
of Devel-hdb​:
http​://matrix.cpantesters.org/?dist=Devel-hdb%200.23_14

I can reproduce this problem on FreeBSD-11.1 with a perl built from
commit 64a9c78, which was committed to blead on May 11. See
attachments.

However, on the same system used in my previous report, I installed Perl 5 blead (197e798) and, using cpanm, was able to install Devel-hdb-0.23 against blead. Devel-hdb-0.23_14 failed, but with errors more like those seen in http​://www.cpantesters.org/cpan/report/fd936088-4dd0-11e8-9eb2-d15040e7b18e.

So these errors are clearly intermittent.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2018

From @iabyn

On Sat, Jun 09, 2018 at 05​:55​:59AM -0700, slaven@​rezic.de (via RT) wrote​:

Test failure looks like this​:

Can't get breakpoint​: Can't connect to 127.0.0.1​:44242 (Connection refused)# Looks like your test exited with 61 just after 6.
t/04-get-all-breakpoints.t ........
Dubious, test returned 61 (wstat 15616, 0x3d00)
Failed 7/13 subtests

I see similar failures (after 1-200 runs) on both 5.26.0 and blead,
so it's not a regression, and thus unlikely to be something to delay
the release of 5.28.0.

Whether its a problem with perl or elsewhere, I don't yet know.

--
Overhead, without any fuss, the stars were going out.
  -- Arthur C Clarke

@p5pRT
Copy link
Author

p5pRT commented Jun 18, 2018

From @iabyn

On Fri, Jun 15, 2018 at 03​:38​:09PM +0100, Dave Mitchell wrote​:

On Sat, Jun 09, 2018 at 05​:55​:59AM -0700, slaven@​rezic.de (via RT) wrote​:

Test failure looks like this​:

Can't get breakpoint​: Can't connect to 127.0.0.1​:44242 (Connection refused)# Looks like your test exited with 61 just after 6.
t/04-get-all-breakpoints.t ........
Dubious, test returned 61 (wstat 15616, 0x3d00)
Failed 7/13 subtests

I see similar failures (after 1-200 runs) on both 5.26.0 and blead,
so it's not a regression, and thus unlikely to be something to delay
the release of 5.28.0.

It becomes fully reproducible under clang and address sanitizer, but
working out exactly what's going on and which end need fixing, is quite
hard. I've added some more info to what turned out to be an
already-existent ticket on github​:

brummett/Devel-hdb#115

--
"There's something wrong with our bloody ships today, Chatfield."
  -- Admiral Beatty at the Battle of Jutland, 31st May 1916.

@p5pRT
Copy link
Author

p5pRT commented Jun 20, 2018

From @iabyn

On Mon, Jun 18, 2018 at 01​:11​:11PM +0100, Dave Mitchell wrote​:

It becomes fully reproducible under clang and address sanitizer, but
working out exactly what's going on and which end need fixing, is quite
hard. I've added some more info to what turned out to be an
already-existent ticket on github​:

brummett/Devel-hdb#115

Working with the module's author, I have narrowed the issue and found a
way of reproducing in core perl. Here's roughly what I said in the github
ticket​:

Using valgrind, I can now reliably reproduce the problem.

  $ cat Foo.pm
  package Foo;
  $x = 1;
  1;

  $ cat foo
  use Foo;
  $x = 2;

  $ valgrind ./perl -Ilib -I. -d foo
  ....
  DB<1> b Foo.pm​:2
  ==19008== Invalid read of size 1
  ==19008== at 0x5AECF3​: Perl_magic_setdbline (mg.c​:2140)
  ....

The general issue is in trying to set a breakpoint on a line in the main
body (as opposed to within a subroutine) of a require'd Foo.pm file. After
Foo.pm has been compiled and executed, all its main body ops are thrown
away (require is just a glorified eval, after all). However, %dbline still
contains IVs which have values which are 'secret', non-refcounted pointers
back to those ops (which have since been freed). So any attempt to set a
breakpoint tries to set a flag on a dbstate op which has either been
freed or reallocated as something else (and so crashes ensue).

It looks like a more general fix will need to be in perl itself.
although I haven't got a clue how.

--
"There's something wrong with our bloody ships today, Chatfield."
  -- Admiral Beatty at the Battle of Jutland, 31st May 1916.

@p5pRT
Copy link
Author

p5pRT commented Jun 20, 2018

From @nwc10

On Wed, Jun 20, 2018 at 11​:47​:11AM +0100, Dave Mitchell wrote​:

The general issue is in trying to set a breakpoint on a line in the main
body (as opposed to within a subroutine) of a require'd Foo.pm file. After
Foo.pm has been compiled and executed, all its main body ops are thrown
away (require is just a glorified eval, after all). However, %dbline still
contains IVs which have values which are 'secret', non-refcounted pointers
back to those ops (which have since been freed). So any attempt to set a
breakpoint tries to set a flag on a dbstate op which has either been
freed or reallocated as something else (and so crashes ensue).

It looks like a more general fix will need to be in perl itself.
although I haven't got a clue how.

1) Step away from the keyboard
2) Make tea
3) Drink tea
4) goto 1

(for some value of "tea" that might actually be alcoholic. If so, please
modify the pseudocode and add a loop termination condition.)

Only thin I can think of is that effectively one needs to clear the
"secret" pointers. Hence, when freeing OPs, if %dbline exists, find and
delete the relevant entries.

But I don't know if there's a direct lookup from pointer to entry.
Or whether that's going to need another lookup hash (or ptr_table?) or field
in a dbstate op) to keep updated.

And this is all more overhead, and tricky to both make robust and have
minimal impact for the 99% case of "not using the debugger"

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Jun 20, 2018

From @cpansprout

On Wed, 20 Jun 2018 04​:19​:31 -0700, nicholas wrote​:

On Wed, Jun 20, 2018 at 11​:47​:11AM +0100, Dave Mitchell wrote​:

The general issue is in trying to set a breakpoint on a line in the main
body (as opposed to within a subroutine) of a require'd Foo.pm file. After
Foo.pm has been compiled and executed, all its main body ops are thrown
away (require is just a glorified eval, after all). However, %dbline still
contains IVs which have values which are 'secret', non-refcounted pointers
back to those ops (which have since been freed). So any attempt to set a
breakpoint tries to set a flag on a dbstate op which has either been
freed or reallocated as something else (and so crashes ensue).

It looks like a more general fix will need to be in perl itself.
although I haven't got a clue how.

1) Step away from the keyboard
2) Make tea
3) Drink tea
4) goto 1

(for some value of "tea" that might actually be alcoholic. If so, please
modify the pseudocode and add a loop termination condition.)

Only thin I can think of is that effectively one needs to clear the
"secret" pointers. Hence, when freeing OPs, if %dbline exists, find and
delete the relevant entries.

But I don't know if there's a direct lookup from pointer to entry.
Or whether that's going to need another lookup hash (or ptr_table?) or field
in a dbstate op) to keep updated.

And this is all more overhead, and tricky to both make robust and have
minimal impact for the 99% case of "not using the debugger"

See #119801. I fixed this, but it broke Enbugger. I couldn’t figure out a way to get Enbugger to work with my patch in place, so I reverted it in despair.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2018

From @rocky

I had noticed that Enbugger broke (SEGV's) around 5.26.2 and suspected this
might be related.

Maybe the solution is to change Enbugger?

On Wed, Jun 20, 2018 at 7​:44 PM, Father Chrysostomos via RT <
perlbug-followup@​perl.org> wrote​:

On Wed, 20 Jun 2018 04​:19​:31 -0700, nicholas wrote​:

On Wed, Jun 20, 2018 at 11​:47​:11AM +0100, Dave Mitchell wrote​:

The general issue is in trying to set a breakpoint on a line in the
main
body (as opposed to within a subroutine) of a require'd Foo.pm file.
After
Foo.pm has been compiled and executed, all its main body ops are thrown
away (require is just a glorified eval, after all). However, %dbline
still
contains IVs which have values which are 'secret', non-refcounted
pointers
back to those ops (which have since been freed). So any attempt to set
a
breakpoint tries to set a flag on a dbstate op which has either been
freed or reallocated as something else (and so crashes ensue).

It looks like a more general fix will need to be in perl itself.
although I haven't got a clue how.

1) Step away from the keyboard
2) Make tea
3) Drink tea
4) goto 1

(for some value of "tea" that might actually be alcoholic. If so, please
modify the pseudocode and add a loop termination condition.)

Only thin I can think of is that effectively one needs to clear the
"secret" pointers. Hence, when freeing OPs, if %dbline exists, find and
delete the relevant entries.

But I don't know if there's a direct lookup from pointer to entry.
Or whether that's going to need another lookup hash (or ptr_table?) or
field
in a dbstate op) to keep updated.

And this is all more overhead, and tricky to both make robust and have
minimal impact for the 99% case of "not using the debugger"

See #119801. I fixed this, but it broke Enbugger. I couldn’t figure out
a way to get Enbugger to work with my patch in place, so I reverted it in
despair.

--

Father Chrysostomos

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

@xenu xenu removed the Severity Low label Dec 29, 2021
@jkeenan jkeenan added BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) non-5.36-blocker labels Mar 15, 2022
@jkeenan
Copy link
Contributor

jkeenan commented Apr 1, 2022

I was able to install Devel-hdb-0.25 against Perl 5 blead today (on FreeBSD 13). The module is doing well on CPANtesters. So this ticket is closable.

@jkeenan jkeenan closed this as completed Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s)
Projects
None yet
Development

No branches or pull requests

3 participants