当前位置: 技术问答>linux和unix
高手请进!
来源: 互联网 发布时间:2016-09-21
本文导语: 1、我在一个台机器上对进程进行编译,运行正常 Linux imatch-13 2.6.18-93.el5.custom #1 SMP Wed Jun 18 16:15:54 CST 2008 x86_64 x86_64 x86_64 GNU/Linux g++ (GCC) 3.4.6 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; s...
1、我在一个台机器上对进程进行编译,运行正常
Linux imatch-13 2.6.18-93.el5.custom #1 SMP Wed Jun 18 16:15:54 CST 2008 x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
不过在另外一台机器上运行:
Linux qa-qd-62-94 2.6.18-131.el5.customxen #1 SMP Tue Sep 15 15:46:11 CST 2009 x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
出现如下错误:
Usage: is_merge_server -c -k start|stop|restart [-l ] [-d]
[-v] [-V] [-h]
Options:
-c : specify an alternate ServerConfigFile
-l : specify an alternate log serup conf file
-k start|stop|restart : specify an alternate server operator
-d : set self process as daemon
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
Example:
is_merge_server -c server.cfg -k restart -l log.cfg -d
*** glibc detected *** ./is_merger_server: double free or corruption (fasttop): 0x000000001e2155d0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x343ae71ce2]
/lib64/libc.so.6(cfree+0x8c)[0x343ae7590c]
/home/qaadmin/search/opt/alog/lib/libalog.so.0[0x2b1a72a0d6ec]
/lib64/libc.so.6(__cxa_finalize+0x8e)[0x343ae3363e]
/home/qaadmin/search/opt/alog/lib/libalog.so.0[0x2b1a72a0bd86]
======= Memory map: ========
00400000-00a69000 r-xp 00000000 ca:01 7176195 /home/qaadmin/search/bin/is_merger_server
00c68000-00ca3000 rw-p 00668000 ca:01 7176195 /home/qaadmin/search/bin/is_merger_server
00ca3000-016dc000 rw-p 00ca3000 00:00 0
1e214000-1e256000 rw-p 1e214000 00:00 0
343aa00000-343aa1c000 r-xp 00000000 ca:01 11501738 /lib64/ld-2.5.so
343ac1b000-343ac1c000 r--p 0001b000 ca:01 11501738 /lib64/ld-2.5.so
343ac1c000-343ac1d000 rw-p 0001c000 ca:01 11501738 /lib64/ld-2.5.so
343ae00000-343af4c000 r-xp 00000000 ca:01 11501862 /lib64/libc-2.5.so
343af4c000-343b14c000 ---p 0014c000 ca:01 11501862 /lib64/libc-2.5.so
343b14c000-343b150000 r--p 0014c000 ca:01 11501862 /lib64/libc-2.5.so
343b150000-343b151000 rw-p 00150000 ca:01 11501862 /lib64/libc-2.5.so
343b151000-343b156000 rw-p 343b151000 00:00 0
343b200000-343b202000 r-xp 00000000 ca:01 11501863 /lib64/libdl-2.5.so
343b202000-343b402000 ---p 00002000 ca:01 11501863 /lib64/libdl-2.5.so
343b402000-343b403000 r--p 00002000 ca:01 11501863 /lib64/libdl-2.5.so
343b403000-343b404000 rw-p 00003000 ca:01 11501863 /lib64/libdl-2.5.so
343b600000-343b682000 r-xp 00000000 ca:01 11501876 /lib64/libm-2.5.so
343b682000-343b881000 ---p 00082000 ca:01 11501876 /lib64/libm-2.5.so
343b881000-343b882000 r--p 00081000 ca:01 11501876 /lib64/libm-2.5.so
343b882000-343b883000 rw-p 00082000 ca:01 11501876 /lib64/libm-2.5.so
343ba00000-343ba16000 r-xp 00000000 ca:01 11501878 /lib64/libpthread-2.5.so
343ba16000-343bc15000 ---p 00016000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc15000-343bc16000 r--p 00015000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc16000-343bc17000 rw-p 00016000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc17000-343bc1b000 rw-p 343bc17000 00:00 0
343be00000-343be07000 r-xp 00000000 ca:01 11501879 /lib64/librt-2.5.so
343be07000-343c007000 ---p 00007000 ca:01 11501879 /lib64/librt-2.5.so
343c007000-343c008000 r--p 00007000 ca:01 11501879 /lib64/librt-2.5.so
343c008000-343c009000 rw-p 00008000 ca:01 11501879 /lib64/librt-2.5.so
343c200000-343c214000 r-xp 00000000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
343c214000-343c413000 ---p 00014000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
343c413000-343c414000 rw-p 00013000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
344c000000-344c00d000 r-xp 00000000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344c00d000-344c20d000 ---p 0000d000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344c20d000-344c20e000 rw-p 0000d000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344d800000-344d8e6000 r-xp 00000000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344d8e6000-344dae5000 ---p 000e6000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344dae5000-344daeb000 r--p 000e5000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344daeb000-344daee000 rw-p 000eb000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344daee000-344db00000 rw-p 344daee000 00:00 0
2b1a72016000-2b1a72018000 rw-p 2b1a72016000 00:00 0
2b1a72018000-2b1a7201b000 r-xp 00000000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7201b000-2b1a7221a000 ---p 00003000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7221a000-2b1a7221b000 rw-p 00002000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7221b000-2b1a722b4000 r-xp 00000000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a722b4000-2b1a723b4000 ---p 00099000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a723b4000-2b1a723b8000 rw-p 00099000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a723b8000-2b1a723d9000 rw-p 2b1a723b8000 00:00 0
2b1a723d9000-2b1a72425000 r-xp 00000000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72425000-2b1a72524000 ---p 0004c000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72524000-2b1a72526000 rw-p 0004b000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72526000-2b1a725b6000 rw-p 2b1a72526000 00:00 0
2b1a725c7000-2b1a725c8000 rw-p 2b1a725c7000 00:00 0
2b1a725c8000-2b1a725d5000 r-xp 00000000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a725d5000-2b1a727d5000 ---p 0000d000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a727d5000-2b1a727d6000 rw-p 0000d000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a727d6000-2b1a72800000 r-xp 00000000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72800000-2b1a72a00000 ---p 0002a000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72a00000-2b1a72a02000 rw-p 0002a000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72a02000-2b1a72a03000 rw-p 2b1a72a02000 00:00 0
2b1a72a03000-2b1a72a1f000 r-xp 00000000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72a1f000-2b1a72c1e000 ---p 0001c000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72c1e000-2b1a72c20000 rw-p 0001b000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72c20000-2b1a72c24000 rw-p 2b1a72c20000 00:00 0
2b1a74000000-2b1a74021000 rw-p 2b1a74000000 00:00 0
2b1a74021000-2b1a78000000 ---p 2b1a74021000 00:00 0
7fff38a7e000-7fff38a93000 rw-p 7ffffffea000 00:00 0 [stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vdso]
Aborted (core dumped)
从错误显然可以看出是重复释放libalog.so.0的原因。为什么同一个二进制文件,在不同的服务器上会有不同的结果呢?
Linux imatch-13 2.6.18-93.el5.custom #1 SMP Wed Jun 18 16:15:54 CST 2008 x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
不过在另外一台机器上运行:
Linux qa-qd-62-94 2.6.18-131.el5.customxen #1 SMP Tue Sep 15 15:46:11 CST 2009 x86_64 x86_64 x86_64 GNU/Linux
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
出现如下错误:
Usage: is_merge_server -c -k start|stop|restart [-l ] [-d]
[-v] [-V] [-h]
Options:
-c : specify an alternate ServerConfigFile
-l : specify an alternate log serup conf file
-k start|stop|restart : specify an alternate server operator
-d : set self process as daemon
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
Example:
is_merge_server -c server.cfg -k restart -l log.cfg -d
*** glibc detected *** ./is_merger_server: double free or corruption (fasttop): 0x000000001e2155d0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x343ae71ce2]
/lib64/libc.so.6(cfree+0x8c)[0x343ae7590c]
/home/qaadmin/search/opt/alog/lib/libalog.so.0[0x2b1a72a0d6ec]
/lib64/libc.so.6(__cxa_finalize+0x8e)[0x343ae3363e]
/home/qaadmin/search/opt/alog/lib/libalog.so.0[0x2b1a72a0bd86]
======= Memory map: ========
00400000-00a69000 r-xp 00000000 ca:01 7176195 /home/qaadmin/search/bin/is_merger_server
00c68000-00ca3000 rw-p 00668000 ca:01 7176195 /home/qaadmin/search/bin/is_merger_server
00ca3000-016dc000 rw-p 00ca3000 00:00 0
1e214000-1e256000 rw-p 1e214000 00:00 0
343aa00000-343aa1c000 r-xp 00000000 ca:01 11501738 /lib64/ld-2.5.so
343ac1b000-343ac1c000 r--p 0001b000 ca:01 11501738 /lib64/ld-2.5.so
343ac1c000-343ac1d000 rw-p 0001c000 ca:01 11501738 /lib64/ld-2.5.so
343ae00000-343af4c000 r-xp 00000000 ca:01 11501862 /lib64/libc-2.5.so
343af4c000-343b14c000 ---p 0014c000 ca:01 11501862 /lib64/libc-2.5.so
343b14c000-343b150000 r--p 0014c000 ca:01 11501862 /lib64/libc-2.5.so
343b150000-343b151000 rw-p 00150000 ca:01 11501862 /lib64/libc-2.5.so
343b151000-343b156000 rw-p 343b151000 00:00 0
343b200000-343b202000 r-xp 00000000 ca:01 11501863 /lib64/libdl-2.5.so
343b202000-343b402000 ---p 00002000 ca:01 11501863 /lib64/libdl-2.5.so
343b402000-343b403000 r--p 00002000 ca:01 11501863 /lib64/libdl-2.5.so
343b403000-343b404000 rw-p 00003000 ca:01 11501863 /lib64/libdl-2.5.so
343b600000-343b682000 r-xp 00000000 ca:01 11501876 /lib64/libm-2.5.so
343b682000-343b881000 ---p 00082000 ca:01 11501876 /lib64/libm-2.5.so
343b881000-343b882000 r--p 00081000 ca:01 11501876 /lib64/libm-2.5.so
343b882000-343b883000 rw-p 00082000 ca:01 11501876 /lib64/libm-2.5.so
343ba00000-343ba16000 r-xp 00000000 ca:01 11501878 /lib64/libpthread-2.5.so
343ba16000-343bc15000 ---p 00016000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc15000-343bc16000 r--p 00015000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc16000-343bc17000 rw-p 00016000 ca:01 11501878 /lib64/libpthread-2.5.so
343bc17000-343bc1b000 rw-p 343bc17000 00:00 0
343be00000-343be07000 r-xp 00000000 ca:01 11501879 /lib64/librt-2.5.so
343be07000-343c007000 ---p 00007000 ca:01 11501879 /lib64/librt-2.5.so
343c007000-343c008000 r--p 00007000 ca:01 11501879 /lib64/librt-2.5.so
343c008000-343c009000 rw-p 00008000 ca:01 11501879 /lib64/librt-2.5.so
343c200000-343c214000 r-xp 00000000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
343c214000-343c413000 ---p 00014000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
343c413000-343c414000 rw-p 00013000 ca:01 21639274 /usr/lib64/libz.so.1.2.3
344c000000-344c00d000 r-xp 00000000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344c00d000-344c20d000 ---p 0000d000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344c20d000-344c20e000 rw-p 0000d000 ca:01 11501877 /lib64/libgcc_s-4.1.2-20080825.so.1
344d800000-344d8e6000 r-xp 00000000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344d8e6000-344dae5000 ---p 000e6000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344dae5000-344daeb000 r--p 000e5000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344daeb000-344daee000 rw-p 000eb000 ca:01 21639260 /usr/lib64/libstdc++.so.6.0.8
344daee000-344db00000 rw-p 344daee000 00:00 0
2b1a72016000-2b1a72018000 rw-p 2b1a72016000 00:00 0
2b1a72018000-2b1a7201b000 r-xp 00000000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7201b000-2b1a7221a000 ---p 00003000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7221a000-2b1a7221b000 rw-p 00002000 ca:01 10715183 /home/qaadmin/search/opt/pool/lib/libpool.so.0
2b1a7221b000-2b1a722b4000 r-xp 00000000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a722b4000-2b1a723b4000 ---p 00099000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a723b4000-2b1a723b8000 rw-p 00099000 ca:01 10518536 /home/qaadmin/search/opt/AliWS-0.6.0/lib/libAliWS.so
2b1a723b8000-2b1a723d9000 rw-p 2b1a723b8000 00:00 0
2b1a723d9000-2b1a72425000 r-xp 00000000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72425000-2b1a72524000 ---p 0004c000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72524000-2b1a72526000 rw-p 0004b000 ca:01 10780695 /home/qaadmin/search/opt/kepler/libkplnmd.so
2b1a72526000-2b1a725b6000 rw-p 2b1a72526000 00:00 0
2b1a725c7000-2b1a725c8000 rw-p 2b1a725c7000 00:00 0
2b1a725c8000-2b1a725d5000 r-xp 00000000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a725d5000-2b1a727d5000 ---p 0000d000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a727d5000-2b1a727d6000 rw-p 0000d000 ca:01 10420361 /home/qaadmin/search/opt/libmemcached/lib/libmemcached.so.2
2b1a727d6000-2b1a72800000 r-xp 00000000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72800000-2b1a72a00000 ---p 0002a000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72a00000-2b1a72a02000 rw-p 0002a000 ca:01 10321972 /home/qaadmin/search/opt/anet/lib/libanet-0.9.3.so.1
2b1a72a02000-2b1a72a03000 rw-p 2b1a72a02000 00:00 0
2b1a72a03000-2b1a72a1f000 r-xp 00000000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72a1f000-2b1a72c1e000 ---p 0001c000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72c1e000-2b1a72c20000 rw-p 0001b000 ca:01 10420385 /home/qaadmin/search/opt/alog/lib/libalog.so.0
2b1a72c20000-2b1a72c24000 rw-p 2b1a72c20000 00:00 0
2b1a74000000-2b1a74021000 rw-p 2b1a74000000 00:00 0
2b1a74021000-2b1a78000000 ---p 2b1a74021000 00:00 0
7fff38a7e000-7fff38a93000 rw-p 7ffffffea000 00:00 0 [stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vdso]
Aborted (core dumped)
从错误显然可以看出是重复释放libalog.so.0的原因。为什么同一个二进制文件,在不同的服务器上会有不同的结果呢?
|
$ man 3 free
......
free() frees the memory space pointed to by ptr, which must have been returned by a
previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has
already been called before, undefined behavior occurs. If ptr is NULL, no operation
is performed.
所谓“undefined behavior”就是说出现什么结果都是有可能的,在不同的硬件、不同的操作系统、不同的配置的结果都有可能不一样。
......
free() frees the memory space pointed to by ptr, which must have been returned by a
previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has
already been called before, undefined behavior occurs. If ptr is NULL, no operation
is performed.
所谓“undefined behavior”就是说出现什么结果都是有可能的,在不同的硬件、不同的操作系统、不同的配置的结果都有可能不一样。
|
未定义结果嘛
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。