ActiPerl + Tcl.pm *** glibc 检测到 *** munmap_chunk(): 无效指针: 0x09b5e0d8

发布于 2024-09-07 04:38:26 字数 6161 浏览 7 评论 0原文

我在 Ubuntu 10.04 机器上安装了 ActivePerl 5.10.1.1007。 我有一个非常简单的 Perl 脚本,包含以下几行:

use lib "/opt/ActivePerl-5.10/lib";
use Tcl;

my $Interpreter = new Tcl;

$Interpreter->Eval('puts "Hello world"');

$Interpreter->Eval('set ::env(TESTVAR) 55')

输出如下:

$ /opt/ActivePerl-5.10/bin/perl5.10.1 simple.pl
Hello world
*** glibc detected *** /opt/ActivePerl-5.10/bin/perl5.10.1: munmap_chunk(): invalid pointer: 0x09b5e0d8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb7696591]
/lib/tls/i686/cmov/libc.so.6(+0x6c80e)[0xb769780e]
/opt/ActivePerl-5.10/bin/perl5.10.1(perl_destruct+0xda6)[0x8071716]
/opt/ActivePerl-5.10/bin/perl5.10.1(main+0xb0)[0x8060a30]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7641bd6]
/opt/ActivePerl-5.10/bin/perl5.10.1(chroot+0x31)[0x80608e1]
======= Memory map: ========
08048000-0815e000 r-xp 00000000 08:11 5154055    /opt/ActivePerl-5.10/bin/perl-static
0815e000-08160000 rwxp 00116000 08:11 5154055    /opt/ActivePerl-5.10/bin/perl-static
09aae000-09bf1000 rwxp 00000000 00:00 0          [heap]
b6ad8000-b6af5000 r-xp 00000000 08:11 3399754    /lib/libgcc_s.so.1
b6af5000-b6af6000 r-xp 0001c000 08:11 3399754    /lib/libgcc_s.so.1
b6af6000-b6af7000 rwxp 0001d000 08:11 3399754    /lib/libgcc_s.so.1
b6af7000-b6b01000 r-xp 00000000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b01000-b6b02000 r-xp 00009000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b02000-b6b03000 rwxp 0000a000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b03000-b6b0b000 r-xp 00000000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0b000-b6b0c000 r-xp 00007000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0c000-b6b0d000 rwxp 00008000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0d000-b6b13000 r-xp 00000000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b13000-b6b14000 r-xp 00006000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b14000-b6b15000 rwxp 00007000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b2a000-b6b2b000 ---p 00000000 00:00 0 
b6b2b000-b732b000 rwxp 00000000 00:00 0 
b74c1000-b74cb000 r-xp 00000000 08:11 5162486    /opt/ActivePerl-5.10/lib/auto/Tcl/Tcl.so
b74cb000-b74cc000 rwxp 00009000 08:11 5162486    /opt/ActivePerl-5.10/lib/auto/Tcl/Tcl.so
b74cc000-b750b000 r-xp 00000000 08:11 5712734    /usr/lib/locale/en_US.utf8/LC_CTYPE
b750b000-b7629000 r-xp 00000000 08:11 5712735    /usr/lib/locale/en_US.utf8/LC_COLLATE
b7629000-b762b000 rwxp 00000000 00:00 0 
b762b000-b777e000 r-xp 00000000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b777e000-b777f000 ---p 00153000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b777f000-b7781000 r-xp 00153000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b7781000-b7782000 rwxp 00155000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b7782000-b7785000 rwxp 00000000 00:00 0 
b7785000-b779a000 r-xp 00000000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779a000-b779b000 r-xp 00014000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779b000-b779c000 rwxp 00015000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779c000-b779e000 rwxp 00000000 00:00 0 
b779e000-b77a0000 r-xp 00000000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a0000-b77a1000 r-xp 00001000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a1000-b77a2000 rwxp 00002000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a2000-b77ab000 r-xp 00000000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ab000-b77ac000 r-xp 00008000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ac000-b77ad000 rwxp 00009000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ad000-b77d4000 rwxp 00000000 00:00 0 
b77d4000-b77f8000 r-xp 00000000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77f8000-b77f9000 r-xp 00023000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77f9000-b77fa000 rwxp 00024000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77fa000-b77fb000 rwxp 00000000 00:00 0 
b77fb000-b77fd000 r-xp 00000000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77fd000-b77fe000 r-xp 00001000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77fe000-b77ff000 rwxp 00002000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77ff000-b7812000 r-xp 00000000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7812000-b7813000 r-xp 00012000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7813000-b7814000 rwxp 00013000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7814000-b7816000 rwxp 00000000 00:00 0 
b781a000-b781b000 r-xp 00000000 08:11 1859586    /usr/lib/locale/en_US.utf8/LC_NUMERIC
b781b000-b781c000 r-xp 00000000 08:11 5712754    /usr/lib/locale/en_US.utf8/LC_TIME
b781c000-b781d000 r-xp 00000000 08:11 5712755    /usr/lib/locale/en_US.utf8/LC_MONETARY
b781d000-b781e000 r-xp 00000000 08:11 5712756    /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
b781e000-b781f000 r-xp 00000000 08:11 1859591    /usr/lib/locale/en_US.utf8/LC_PAPER
b781f000-b7820000 r-xp 00000000 08:11 1859592    /usr/lib/locale/en_US.utf8/LC_NAME
b7820000-b7821000 r-xp 00000000 08:11 5712757    /usr/lib/locale/en_US.utf8/LC_ADDRESS
b7821000-b7822000 r-xp 00000000 08:11 5712758    /usr/lib/locale/en_US.utf8/LC_TELEPHONE
b7822000-b7823000 r-xp 00000000 08:11 1859595    /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
b7823000-b782a000 r-xs 00000000 08:11 5711192    /usr/lib/gconv/gconv-modules.cache
b782a000-b782b000 r-xp 00000000 08:11 5712759    /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
b782b000-b782d000 rwxp 00000000 00:00 0 
b782d000-b782e000 r-xp 00000000 00:00 0          [vdso]
b782e000-b7849000 r-xp 00000000 08:11 3401485    /lib/ld-2.11.1.so
b7849000-b784a000 r-xp 0001a000 08:11 3401485    /lib/ld-2.11.1.so
b784a000-b784b000 rwxp 0001b000 08:11 3401485    /lib/ld-2.11.1.so
bfd36000-bfd4b000 rwxp 00000000 00:00 0          [stack]
Aborted

请帮忙。我找不到办法让这项工作发挥作用。设置非环境变量不会导致崩溃。例如:

 $Interpreter->Eval('set localvar 55')

谢谢!!!

I installed ActivePerl 5.10.1.1007 on my Ubuntu 10.04 machine.
I have a very simple Perl script with the following lines:

use lib "/opt/ActivePerl-5.10/lib";
use Tcl;

my $Interpreter = new Tcl;

$Interpreter->Eval('puts "Hello world"');

$Interpreter->Eval('set ::env(TESTVAR) 55')

The output is the following:

$ /opt/ActivePerl-5.10/bin/perl5.10.1 simple.pl
Hello world
*** glibc detected *** /opt/ActivePerl-5.10/bin/perl5.10.1: munmap_chunk(): invalid pointer: 0x09b5e0d8 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0xb7696591]
/lib/tls/i686/cmov/libc.so.6(+0x6c80e)[0xb769780e]
/opt/ActivePerl-5.10/bin/perl5.10.1(perl_destruct+0xda6)[0x8071716]
/opt/ActivePerl-5.10/bin/perl5.10.1(main+0xb0)[0x8060a30]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7641bd6]
/opt/ActivePerl-5.10/bin/perl5.10.1(chroot+0x31)[0x80608e1]
======= Memory map: ========
08048000-0815e000 r-xp 00000000 08:11 5154055    /opt/ActivePerl-5.10/bin/perl-static
0815e000-08160000 rwxp 00116000 08:11 5154055    /opt/ActivePerl-5.10/bin/perl-static
09aae000-09bf1000 rwxp 00000000 00:00 0          [heap]
b6ad8000-b6af5000 r-xp 00000000 08:11 3399754    /lib/libgcc_s.so.1
b6af5000-b6af6000 r-xp 0001c000 08:11 3399754    /lib/libgcc_s.so.1
b6af6000-b6af7000 rwxp 0001d000 08:11 3399754    /lib/libgcc_s.so.1
b6af7000-b6b01000 r-xp 00000000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b01000-b6b02000 r-xp 00009000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b02000-b6b03000 rwxp 0000a000 08:11 3424653    /lib/tls/i686/cmov/libnss_files-2.11.1.so
b6b03000-b6b0b000 r-xp 00000000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0b000-b6b0c000 r-xp 00007000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0c000-b6b0d000 rwxp 00008000 08:11 3424655    /lib/tls/i686/cmov/libnss_nis-2.11.1.so
b6b0d000-b6b13000 r-xp 00000000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b13000-b6b14000 r-xp 00006000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b14000-b6b15000 rwxp 00007000 08:11 3424651    /lib/tls/i686/cmov/libnss_compat-2.11.1.so
b6b2a000-b6b2b000 ---p 00000000 00:00 0 
b6b2b000-b732b000 rwxp 00000000 00:00 0 
b74c1000-b74cb000 r-xp 00000000 08:11 5162486    /opt/ActivePerl-5.10/lib/auto/Tcl/Tcl.so
b74cb000-b74cc000 rwxp 00009000 08:11 5162486    /opt/ActivePerl-5.10/lib/auto/Tcl/Tcl.so
b74cc000-b750b000 r-xp 00000000 08:11 5712734    /usr/lib/locale/en_US.utf8/LC_CTYPE
b750b000-b7629000 r-xp 00000000 08:11 5712735    /usr/lib/locale/en_US.utf8/LC_COLLATE
b7629000-b762b000 rwxp 00000000 00:00 0 
b762b000-b777e000 r-xp 00000000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b777e000-b777f000 ---p 00153000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b777f000-b7781000 r-xp 00153000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b7781000-b7782000 rwxp 00155000 08:11 3424483    /lib/tls/i686/cmov/libc-2.11.1.so
b7782000-b7785000 rwxp 00000000 00:00 0 
b7785000-b779a000 r-xp 00000000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779a000-b779b000 r-xp 00014000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779b000-b779c000 rwxp 00015000 08:11 3424658    /lib/tls/i686/cmov/libpthread-2.11.1.so
b779c000-b779e000 rwxp 00000000 00:00 0 
b779e000-b77a0000 r-xp 00000000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a0000-b77a1000 r-xp 00001000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a1000-b77a2000 rwxp 00002000 08:11 3424663    /lib/tls/i686/cmov/libutil-2.11.1.so
b77a2000-b77ab000 r-xp 00000000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ab000-b77ac000 r-xp 00008000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ac000-b77ad000 rwxp 00009000 08:11 3424646    /lib/tls/i686/cmov/libcrypt-2.11.1.so
b77ad000-b77d4000 rwxp 00000000 00:00 0 
b77d4000-b77f8000 r-xp 00000000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77f8000-b77f9000 r-xp 00023000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77f9000-b77fa000 rwxp 00024000 08:11 3424648    /lib/tls/i686/cmov/libm-2.11.1.so
b77fa000-b77fb000 rwxp 00000000 00:00 0 
b77fb000-b77fd000 r-xp 00000000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77fd000-b77fe000 r-xp 00001000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77fe000-b77ff000 rwxp 00002000 08:11 3424647    /lib/tls/i686/cmov/libdl-2.11.1.so
b77ff000-b7812000 r-xp 00000000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7812000-b7813000 r-xp 00012000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7813000-b7814000 rwxp 00013000 08:11 3424650    /lib/tls/i686/cmov/libnsl-2.11.1.so
b7814000-b7816000 rwxp 00000000 00:00 0 
b781a000-b781b000 r-xp 00000000 08:11 1859586    /usr/lib/locale/en_US.utf8/LC_NUMERIC
b781b000-b781c000 r-xp 00000000 08:11 5712754    /usr/lib/locale/en_US.utf8/LC_TIME
b781c000-b781d000 r-xp 00000000 08:11 5712755    /usr/lib/locale/en_US.utf8/LC_MONETARY
b781d000-b781e000 r-xp 00000000 08:11 5712756    /usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
b781e000-b781f000 r-xp 00000000 08:11 1859591    /usr/lib/locale/en_US.utf8/LC_PAPER
b781f000-b7820000 r-xp 00000000 08:11 1859592    /usr/lib/locale/en_US.utf8/LC_NAME
b7820000-b7821000 r-xp 00000000 08:11 5712757    /usr/lib/locale/en_US.utf8/LC_ADDRESS
b7821000-b7822000 r-xp 00000000 08:11 5712758    /usr/lib/locale/en_US.utf8/LC_TELEPHONE
b7822000-b7823000 r-xp 00000000 08:11 1859595    /usr/lib/locale/en_US.utf8/LC_MEASUREMENT
b7823000-b782a000 r-xs 00000000 08:11 5711192    /usr/lib/gconv/gconv-modules.cache
b782a000-b782b000 r-xp 00000000 08:11 5712759    /usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
b782b000-b782d000 rwxp 00000000 00:00 0 
b782d000-b782e000 r-xp 00000000 00:00 0          [vdso]
b782e000-b7849000 r-xp 00000000 08:11 3401485    /lib/ld-2.11.1.so
b7849000-b784a000 r-xp 0001a000 08:11 3401485    /lib/ld-2.11.1.so
b784a000-b784b000 rwxp 0001b000 08:11 3401485    /lib/ld-2.11.1.so
bfd36000-bfd4b000 rwxp 00000000 00:00 0          [stack]
Aborted

Please help. I can't find a way to make this work. Setting a non-environment variable does not cause the crash. For example:

 $Interpreter->Eval('set localvar 55')

THANKS!!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

○愚か者の日 2024-09-14 04:38:26

第一阶段分析:退出时内存损坏。我想说的是,对于谁应该释放区块以及如何释放区块存在争论。现在我们深入挖掘……

可能看到了这样一个事实的后果:Perl 和 Tcl 都在独立地尝试解决系统实现中的错误错误特性。环境变量。特别是,C 库的 setenv() 存在许多内存泄漏问题,这使得它比您天真的期望的更加不切实际;我很希望 Perl 能够解决这个问题,而且我知道 Tcl 也能解决这个问题,但这确实意味着只有一种语言应该设置环境变量,并且在这种情况下几乎肯定需要 Perl (根据您提供的证据)。

您真的需要从 Tcl 代码中设置环境变量吗?如果你不能这样做,那将是最简单的前进方法。 :-) 否则,我们讨论的是使用不同的 Tcl 构建(以便它要求 Perl 端进行内存管理)或执行一些魔法来断开 Tcl 端与真实环境的连接。您可能还想向上游的 ActiveState 报告问题。

First stage analysis: memory corruption on exit. I'd say that there's warring over who should free a block and how. Now we dig deeper…

It's possible that you're seeing the consequences of the fact that both Perl and Tcl are independently trying to work around the bugs misfeatures in the system implementation of environment variables. In particular, the C library's setenv() has a number of problems with memory leaks which make it rather more impractical than you might naïvely expect; I'd quite expect Perl to work around this, and I know that Tcl does too, but it does mean that only one language should set environment variables, and that almost certainly needs to be Perl in this case (on the basis of evidence you've presented).

Do you really need to set environment variables from your Tcl code? If you can just not do it, that'd be the easiest way forward. :-) Otherwise, we're talking about having a different build of Tcl (so that it asks the Perl side of things to do the memory management) or doing some magic to disconnect the Tcl side from the real environment. You might also want to report the problem upstream to ActiveState.

情痴 2024-09-14 04:38:26

我会继续挖掘,如果找到解决方案,我会告诉你。
我向 ActiveState 报告了这一情况。内联是我的电子邮件和他们的回复,但总结一下:

1. They didn't develop "Inline Tcl" for Perl nor did they test it.
2. It was developed in 2001 and no additions were made to it since then.
3. When it was developed (in 2001), it was marked as "alpha" and no additions were made since then.



Hi Mircea,

Inline::Tcl is not part of ActivePerl. It's not tested with ActivePerl, and it
does not build on our PPM build farm against ActivePerl:
http://ppm4.activestate.com/i686-linux/5.10/1000/R/RR/RRS/Inline-Tcl-0.09.d/log-20090614T112213.txt

Offhand, the error message looks like a compiler mismatch problem, but it could be
almost anything since Inline::Tcl hasn't been touched by the author since 2001,
and even then the release notes describe it as "alpha software". It doesn't seem
to like Linux very much any more:
http://matrix.cpantesters.org/?dist=Inline-Tcl%200.09;maxver=1
Hmm.. The author's home page is 404. You should probably find another way to do it.

I'll keep digging and if I find the solution I'll let you know.
I reported this to ActiveState. Inline is my email and their response, but to sum up:

1. They didn't develop "Inline Tcl" for Perl nor did they test it.
2. It was developed in 2001 and no additions were made to it since then.
3. When it was developed (in 2001), it was marked as "alpha" and no additions were made since then.



Hi Mircea,

Inline::Tcl is not part of ActivePerl. It's not tested with ActivePerl, and it
does not build on our PPM build farm against ActivePerl:
http://ppm4.activestate.com/i686-linux/5.10/1000/R/RR/RRS/Inline-Tcl-0.09.d/log-20090614T112213.txt

Offhand, the error message looks like a compiler mismatch problem, but it could be
almost anything since Inline::Tcl hasn't been touched by the author since 2001,
and even then the release notes describe it as "alpha software". It doesn't seem
to like Linux very much any more:
http://matrix.cpantesters.org/?dist=Inline-Tcl%200.09;maxver=1
Hmm.. The author's home page is 404. You should probably find another way to do it.
唔猫 2024-09-14 04:38:26

您不需要此行: use lib "/opt/ActivePerl-5.10/lib"; 除非您配置错误。您可能想从轨道上删除安装并重新开始。

您使用 ActivePerl 有什么特殊原因吗?您应该能够简单地 从源代码安装 perl - 您使用的是真正的操作系统,所以我会利用它:)

You should not need this line: use lib "/opt/ActivePerl-5.10/lib"; unless you have a misconfiguration. You might want to nuke the install from orbit and start over.

Is there any particular reason why you are using ActivePerl? You should be able to simply install perl from source -- you're using a real OS, so I'd take advantage of it :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文