Skip Menu |

This queue is for tickets about the Math-BigInt-GMP CPAN distribution.

Report information
The Basics
Id: 49336
Status: resolved
Priority: 0/
Queue: Math-BigInt-GMP

People
Owner: Nobody in particular
Requestors: ASHER [...] cpan.org
Cc: ajs [...] ajs.com
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.24
Fixed in: (no value)



CC: ajs [...] ajs.com
Subject: Math::BigInt::GMP vs threads segfault
The following example demonstrates Math::BigInt::GMP causing a segfault when run in multiple threads on my Ubuntu 9.04 system with perl 5.10.0 built for i486-linux-gnu-thread-multi: $ perl -MMath::BigInt=lib,GMP -Mthreads -le 'async { $n=Math::BigInt->new(2)->bexp(100)->bmodpow(2,80); } for 1..10; map {$_->join()} threads->list(threads::joinable) while threads->list() > 0' Segmentation fault This seems to alternate between segfaults and a glibc error in a non-deterministic way: *** glibc detected *** perl: double free or corruption (!prev): 0x09873710 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb7dda604] /lib/tls/i686/cmov/libc.so.6(cfree+0x96)[0xb7ddc5b6] /usr/lib/perl5/auto/Math/BigInt/GMP/GMP.so(XS_Math__BigInt__GMP_DESTROY+0x182)[0xb7c06272] perl(Perl_pp_entersub+0x552)[0x80b3c92] perl(Perl_call_sv+0x508)[0x80afc18] perl(Perl_sv_clear+0x136)[0x80c6226] perl(Perl_sv_free2+0x4a)[0x80c696a] perl(Perl_sv_clear+0x3c4)[0x80c64b4] perl(Perl_sv_free2+0x4a)[0x80c696a] perl(Perl_hv_free_ent+0x33)[0x80a40c3] perl[0x80a5277] perl(Perl_hv_undef+0x141)[0x80a6fd1] perl(Perl_sv_clear+0x5c6)[0x80c66b6] perl(Perl_sv_free2+0x4a)[0x80c696a] perl(Perl_sv_clear+0x3c4)[0x80c64b4] perl(Perl_sv_free2+0x4a)[0x80c696a] perl(Perl_free_tmps+0x52)[0x80e1492] perl(Perl_pp_nextstate+0x45)[0x80b50b5] perl(Perl_runops_standard+0x19)[0x80b2069] perl(perl_run+0x2e0)[0x80b04d0] perl(main+0xed)[0x8063ebd] /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7d81775] perl[0x8063d31] ======= Memory map: ======== 08048000-0817c000 r-xp 00000000 08:02 8151 /usr/bin/perl 0817c000-0817d000 r--p 00133000 08:02 8151 /usr/bin/perl 0817d000-0817f000 rw-p 00134000 08:02 8151 /usr/bin/perl 09560000-0a020000 rw-p 09560000 00:00 0 [heap] b1800000-b1821000 rw-p b1800000 00:00 0 b1821000-b1900000 ---p b1821000 00:00 0 b1a00000-b1a26000 rw-p b1a00000 00:00 0 b1a26000-b1b00000 ---p b1a26000 00:00 0 b1bff000-b1c00000 ---p b1bff000 00:00 0 b1c00000-b2400000 rw-p b1c00000 00:00 0 b2400000-b2500000 rw-p b2400000 00:00 0 b25ff000-b2600000 ---p b25ff000 00:00 0 b2600000-b2e00000 rw-p b2600000 00:00 0 b2e00000-b2f00000 rw-p b2e00000 00:00 0 b2fff000-b3000000 ---p b2fff000 00:00 0 b3000000-b3800000 rw-p b3000000 00:00 0 b3800000-b3900000 rw-p b3800000 00:00 0 b39ff000-b3a00000 ---p b39ff000 00:00 0 b3a00000-b4200000 rw-p b3a00000 00:00 0 b4200000-b4300000 rw-p b4200000 00:00 0 b43fe000-b43ff000 ---p b43fe000 00:00 0 b43ff000-b4bff000 rw-p b43ff000 00:00 0 b4bff000-b4c00000 ---p b4bff000 00:00 0 b4c00000-b5400000 rw-p b4c00000 00:00 0 b5400000-b5500000 rw-p b5400000 00:00 0 b55ff000-b5600000 ---p b55ff000 00:00 0 b5600000-b5e00000 rw-p b5600000 00:00 0 b5e00000-b5f00000 rw-p b5e00000 00:00 0 b5fff000-b6000000 ---p b5fff000 00:00 0 b6000000-b6800000 rw-p b6000000 00:00 0 b6800000-b6900000 rw-p b6800000 00:00 0 b69ff000-b6a00000 ---p b69ff000 00:00 0 b6a00000-b7200000 rw-p b6a00000 00:00 0 b7200000-b7300000 rw-p b7200000 00:00 0 b7387000-b7394000 r-xp 00000000 08:02 893 /lib/libgcc_s.so.1 b7394000-b7395000 r--p 0000c000 08:02 893 /lib/libgcc_s.so.1 b7395000-b7396000 rw-p 0000d000 08:02 893 /lib/libgcc_s.so.1 b73a6000-b73a7000 ---p b73a6000 00:00 0 b73a7000-b7ba7000 rw-p b73a7000 00:00 0 b7ba7000-b7bec000 r-xp 00000000 08:02 15537 /usr/lib/libgmp.so.3.4.4 b7bec000-b7bed000 r--p 00044000 08:02 15537 /usr/lib/libgmp.so.3.4.4 b7bed000-b7bee000 rw-p 00045000 08:02 15537 /usr/lib/libgmp.so.3.4.4 b7bf2000-b7bfc000 r-xp 00000000 08:02 9172 /usr/lib/perl/5.10.0/auto/threads/threads.so b7bfc000-b7bfd000 r--p 00009000 08:02 9172 /usr/lib/perl/5.10.0/auto/threads/threads.so b7bfd000-b7bfe000 rw-p 0000a000 08:02 9172 /usr/lib/perl/5.10.0/auto/threads/threads.so b7bfe000-b7c0b000 r-xp 00000000 08:02 176168 /usr/lib/perl5/auto/Math/BigInt/GMP/GMP.so b7c0b000-b7c0d000 rw-p 0000c000 08:02 176168 /usr/lib/perl5/auto/Math/BigInt/GMP/GMP.so b7c0d000-b7c4c000 r--p 00000000 08:02 5607 /usr/lib/locale/en_US.utf8/LC_CTYPE b7c4c000-b7c4d000 r--p 00000000 08:02 11414 /usr/lib/locale/en_US.utf8/LC_NUMERIC b7c4d000-b7d38000 r--p 00000000 08:02 11416 /usr/lib/locale/en_US.utf8/LC_COLLATE b7d38000-b7d39000 rw-p b7d38000 00:00 0 b7d39000-b7d42000 r-xp 00000000 08:02 7444 /lib/tls/i686/cmov/libcrypt-2.9.so b7d42000-b7d43000 r--p 00008000 08:02 7444 /lib/tls/i686/cmov/libcrypt-2.9.so b7d43000-b7d44000 rw-p 00009000 08:02 7444 /lib/tls/i686/cmov/libcrypt-2.9.so b7d44000-b7d6b000 rw-p b7d44000 00:00 0 b7d6b000-b7ec7000 r-xp 00000000 08:02 7442 /lib/tls/i686/cmov/libc-2.9.so b7ec7000-b7ec8000 ---p 0015c000 08:02 7442 /lib/tls/i686/cmov/libc-2.9.so b7ec8000-b7eca000 r--p 0015c000 08:02 7442 /lib/tls/i686/cmov/libc-2.9.so b7eca000-b7ecb000 rw-p 0015e000 08:02 7442 /lib/tls/i686/cmov/libc-2.9.so b7ecb000-b7ece000 rw-p b7ecb000 00:00 0 b7ece000-b7ee3000 r-xp 00000000 08:02 7456 /lib/tls/i686/cmov/libpthread-2.9.so b7ee3000-b7ee4000 r--p 00014000 08:02 7456 /lib/tls/i686/cmov/libpthread-2.9.so b7ee4000-b7ee5000 rw-p 00015000 08:02 7456 /lib/tls/i686/cmov/libpthread-2.9.so b7ee5000-b7ee8000 rw-p b7ee5000 00:00 0 b7ee8000-b7f0c000 r-xp 00000000 08:02 7446 /lib/tls/i686/cmov/libm-2.9.so b7f0c000-b7f0d000 r--p 00023000 08:02 7446 /lib/tls/i686/cmov/libm-2.9.so b7f0d000-b7f0e000 rw-p 00024000 08:02 7446 /lib/tls/i686/cmov/libm-2.9.so b7f0e000-b7f10000 r-xp 00000000 08:02 7445 /lib/tls/i686/cmov/libdl-2.9.so b7f10000-b7f11000 r--p 00001000 08:02 7445 /lib/tls/i686/cmov/libdl-2.9.so b7f11000-b7f12000 rw-p 00002000 08:02 7445 /lib/tls/i686/cmov/libdl-2.9.so b7f12000-b7f13000 r--p 00000000 08:02 11415 /usr/lib/locale/en_US.utf8/LC_TIME b7f13000-b7f14000 r--p 00000000 08:02 11417 /usr/lib/locale/en_US.utf8/LC_MONETARY b7f14000-b7f15000 r--p 00000000 08:02 11419 /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES b7f15000-b7f16000 r--p 00000000 08:02 11420 /usr/lib/locale/en_US.utf8/LC_PAPER b7f16000-b7f17000 r--p 00000000 08:02 11421 /usr/lib/locale/en_US.utf8/LC_NAME b7f17000-b7f18000 r--p 00000000 08:02 11422 /usr/lib/locale/en_US.utf8/LC_ADDRESS b7f18000-b7f19000 r--p 00000000 08:02 11423 /usr/lib/locale/en_US.utf8/LC_TELEPHONE b7f19000-b7f1a000 r--p 00000000 08:02 11424 /usr/lib/locale/en_US.utf8/LC_MEASUREMENT b7f1a000-b7f21000 r--s 00000000 08:02 882 /usr/lib/gconv/gconv-modules.cache b7f21000-b7f22000 r--p 00000000 08:02 11425 /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION b7f22000-b7f24000 rw-p b7f22000 00:00 0 b7f24000-b7f25000 r-xp b7f24000 00:00 0 [vdso] b7f25000-b7f41000 r-xp 00000000 08:02 1229 /lib/ld-2.9.so b7f41000-b7f42000 r--p 0001b000 08:02 1229 /lib/ld-2.9.so b7f42000-b7f43000 rw-p 0001c000 08:02 1229 /lib/ld-2.9.so bf92e000-bf943000 rw-p bffeb000 00:00 0 [stack] Aborted
RT-Send-CC: ajs [...] ajs.com
The development release 1.26 is supposed to make the module threadsafe. It now passes various tests involving threads, and also stops the oneliner you provided from failing. I'd appreciate if you could give 1.26 a try and see if it also fixes your actual problem.
From: ajs [...] ajs.com
On Tue Sep 14 14:21:10 2010, FLORA wrote: Show quoted text
> The development release 1.26 is supposed to make the module threadsafe. > It now passes various tests involving threads, and also stops the > oneliner you provided from failing. > > I'd appreciate if you could give 1.26 a try and see if it also fixes > your actual problem.
As indicated, this resolved the problem that I was having. Thanks!