java双免费或腐败

时间:2014-03-18 21:50:29

标签: java ubuntu

也许是个愚蠢的问题,但是在运行我的* .jar包时我会随机跟踪错误。有时程序运行完美无缺,有时会中断将它放在控制台中:

*** Error in 'java': double free or corruption (out): 0x00007f665c04a830 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f66c63d7a46]
/usr/lib/libjnetpcap.so(Java_org_jnetpcap_nio_JMemoryReference_disposeNative0+0xa6)[0x7f66b55f20eb]
[0x7f66bc5cd738]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:02 2752983                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
00600000-00601000 r--p 00000000 08:02 2752983                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
00601000-00602000 rw-p 00001000 08:02 2752983                            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
006d2000-006f3000 rw-p 00000000 00:00 0                                  [heap]
77b000000-77c500000 rw-p 00000000 00:00 0 
77c500000-785600000 rw-p 00000000 00:00 0 
785600000-78a780000 rw-p 00000000 00:00 0 
78a780000-7d7200000 rw-p 00000000 00:00 0 
7d7200000-7d9b00000 rw-p 00000000 00:00 0 
7d9b00000-800000000 rw-p 00000000 00:00 0 
7f664c000000-7f664c021000 rw-p 00000000 00:00 0 
7f664c021000-7f6650000000 ---p 00000000 00:00 0 
7f6654000000-7f6654021000 rw-p 00000000 00:00 0 
7f6654021000-7f6658000000 ---p 00000000 00:00 0 
7f6658000000-7f6658021000 rw-p 00000000 00:00 0 
7f6658021000-7f665c000000 ---p 00000000 00:00 0 
7f665c000000-7f665c0ac000 rw-p 00000000 00:00 0 
7f665c0ac000-7f6660000000 ---p 00000000 00:00 0 
7f6660000000-7f6660021000 rw-p 00000000 00:00 0 
7f6660021000-7f6664000000 ---p 00000000 00:00 0 
7f6664000000-7f66641ad000 rw-p 00000000 00:00 0 
7f66641ad000-7f6668000000 ---p 00000000 00:00 0 
7f6668000000-7f6668021000 rw-p 00000000 00:00 0 
7f6668021000-7f666c000000 ---p 00000000 00:00 0 
7f666c000000-7f666c021000 rw-p 00000000 00:00 0 
7f666c021000-7f6670000000 ---p 00000000 00:00 0 
7f6670000000-7f6670021000 rw-p 00000000 00:00 0 
7f6670021000-7f6674000000 ---p 00000000 00:00 0 
7f6674000000-7f6674021000 rw-p 00000000 00:00 0 
7f6674021000-7f6678000000 ---p 00000000 00:00 0 
7f667969a000-7f667969d000 ---p 00000000 00:00 0 
7f667969d000-7f667979b000 rw-p 00000000 00:00 0                          [stack:5820]
7f667979b000-7f667979e000 ---p 00000000 00:00 0 
7f667979e000-7f667989c000 rw-p 00000000 00:00 0                          [stack:5819]
7f667989c000-7f667989f000 ---p 00000000 00:00 0 
7f667989f000-7f667999d000 rw-p 00000000 00:00 0                          [stack:5818]
7f667999d000-7f6679bbd000 rw-s 00000000 00:07 220407                     socket:[220407]
7f6679bbd000-7f6679bc0000 ---p 00000000 00:00 0 
7f6679bc0000-7f6679cbe000 rw-p 00000000 00:00 0                          [stack:5817]
7f6679cbe000-7f6679cc1000 ---p 00000000 00:00 0 
7f6679cc1000-7f6679dbf000 rw-p 00000000 00:00 0                          [stack:5816]
7f6679dbf000-7f6679fdf000 rw-s 00000000 00:07 219343                     socket:[219343]
7f6679fdf000-7f6679fe2000 ---p 00000000 00:00 0 
7f6679fe2000-7f667a0e0000 rw-p 00000000 00:00 0                          [stack:5814]
7f667a0e0000-7f667a0fb000 r--s 00000000 08:02 1970077                    /usr/share/fonts/type1/gsfonts/p052003l.pfb
7f667a0fb000-7f667a10d000 r--s 00000000 08:02 1970041                    /usr/share/fonts/type1/gsfonts/n019043l.pfb
7f667a10d000-7f667a126000 r--s 00000000 08:02 1970000                    /usr/share/fonts/type1/gsfonts/b018012l.pfb
7f667a12f000-7f667a130000 rw-p 00000000 00:00 0 
7f667a130000-7f667a133000 rw-s 00000000 00:04 17236023                   /SYSV00000000 (deleted)
7f667a133000-7f667a143000 r--s 00000000 08:02 1969994                    /usr/share/fonts/type1/gsfonts/a010033l.pfb
7f667a143000-7f667a14f000 r--s 00000000 08:02 1970025                    /usr/share/fonts/type1/gsfonts/d050000l.pfb
7f667a14f000-7f667a164000 r--s 00000000 08:02 1970006                    /usr/share/fonts/type1/gsfonts/b018032l.pfb
7f667a164000-7f667a177000 r--s 00000000 08:02 1970003                    /usr/share/fonts/type1/gsfonts/b018015l.pfb
7f667a177000-7f667a191000 r--s 00000000 08:02 1970012                    /usr/share/fonts/type1/gsfonts/c059013l.pfb
7f667a191000-7f667a1a8000 r--s 00000000 08:02 1970094                    /usr/share/fonts/type1/gsfonts/z003034l.pfb
7f667a1a8000-7f667a1c3000 r--s 00000000 08:02 1970080                    /usr/share/fonts/type1/gsfonts/p052004l.pfb
7f667a1c3000-7f667a1d4000 r--s 00000000 08:02 1970047                    /usr/share/fonts/type1/gsfonts/n019063l.pfb
7f667a1d4000-7f667a1e5000 r--s 00000000 08:02 1969997                    /usr/share/fonts/type1/gsfonts/a010035l.pfb
7f667a1e5000-7f667a1ee000 r--s 00000000 08:02 1970089                    /usr/share/fonts/type1/gsfonts/s050000l.pfb
7f667a1ee000-7f667a1fe000 r--s 00000000 08:02 1969991                    /usr/share/fonts/type1/gsfonts/a010015l.pfb
7f667a1fe000-7f667a21a000 r--s 00000000 08:02 1970086                    /usr/share/fonts/type1/gsfonts/p052024l.pfb
7f667a21a000-7f667a232000 r--s 00000000 08:02 1970022                    /usr/share/fonts/type1/gsfonts/c059036l.pfb
7f667a232000-7f667a24d000 r--s 00000000 08:02 1970083                    /usr/share/fonts/type1/gsfonts/p052023l.pfb
7f667a24d000-7f667a25f000 r--s 00000000 08:02 1970009                    /usr/share/fonts/type1/gsfonts/b018035l.pfb
7f667a25f000-7f667a26f000 r--s 00000000 08:02 1969988                    /usr/share/fonts/type1/gsfonts/a010013l.pfb
7f667a26f000-7f667a28a000 r--s 00000000 08:02 1970015                    /usr/share/fonts/type1/gsfonts/c059016l.pfb
7f667a28a000-7f667a29c000 r--s 00000000 08:02 1970044                    /usr/share/fonts/type1/gsfonts/n019044l.pfb
7f667a29c000-7f667a2af000 r--s 00000000 08:02 1970050                    /usr/share/fonts/type1/gsfonts/n019064l.pfb
7f667a2af000-7f667a2c7000 r--s 00000000 08:02 1970018                    /usr/share/fonts/type1/gsfonts/c059033l.pfb
7f667a2c7000-7f667a2e5000 r--s 00000000 08:02 1275703                    /usr/share/texmf/fonts/type1/public/lm/lmr10.pfb
7f667a2e5000-7f667a307000 r--s 00000000 08:02 1978245                    /usr/share/texmf/fonts/type1/public/tex-gyre/qplr.pfb
7f667a307000-7f667a327000 r--s 00000000 08:02 1978229                    /usr/share/texmf/fonts/type1/public/tex-gyre/qbkbi.pfb
7f667a327000-7f667a341000 r--s 00000000 08:02 1978241                    /usr/share/texmf/fonts/type1/public/tex-gyre/qagbi.pfb
7f667a341000-7f667a35c000 r--s 00000000 08:02 1275730                    /usr/share/texmf/fonts/type1/public/lm/lmtcsc10.pfb
7f667a35c000-7f667a376000 r--s 00000000 08:02 1978256                    /usr/share/texmf/fonts/type1/public/tex-gyre/qhvbi.pfb
7f667a376000-7f667a37f000 r--s 00000000 08:02 1969318                    /usr/share/fonts/X11/Type1/c0649bt_.pfb
7f667a37f000-7f667a3a1000 r--s 00000000 08:02 1275718                    /usr/share/texmf/fonts/type1/public/lm/lmtlco10.pfb
7f667a3a1000-7f667a3c1000 r--s 00000000 08:02 1978224                    /usr/share/texmf/fonts/type1/public/tex-gyre/qtmbi.pfb
7f667a3c1000-7f667a3de000 r--s 00000000 08:02 1275759                    /usr/share/texmf/fonts/type1/public/lm/lmssqbx8.pfb
7f667a3de000-7f667a3f9000 r--s 00000000 08:02 1275756                    /usr/share/texmf/fonts/type1/public/lm/lmsso10.pfb

我正在使用64位的Ubuntu 13.10,正在运行:

java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.04.2)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

感谢您的帮助:)

1 个答案:

答案 0 :(得分:11)

我知道这是一个旧线程,但万一有人在同一错误中失败。

  

这是您正在使用的本机库的多线程问题。

简而言之,java将本机库加载到内存中,然后由多个线程同时访问,然后弹出此错误。

此问题的快速解决方法是将生成此错误的方法标记为synchronized


@kit评论后更新。

无法在多线程环境中运行此类本机库。

您的选择是:

  • 修改本机库以使其具有线程安全性(如果您可以访问其代码)。
  • 将其作为应用程序包装并作为单独的进程运行多个副本(因为每个进程加载一次本机库)
  • 将其作为服务包装并运行多个副本,使用套接字或适当的更高级别的RPC机制与它通信。

致谢:Load the same dynamic library in two threads (both threads in the same JVM)