GC seems to kill process

Andi Vajda andi@osafoundation.org
Wed Mar 22 21:28:00 GMT 2006


On 2006年3月22日, Andi Vajda wrote:
> I then ran the same thing in gdb and got this:
>> Starting program: /usr/local/bin/python
> [Thread debugging using libthread_db enabled]
> [New Thread 16384 (LWP 16079)]
> Python 2.4.2 (#1, Mar 22 2006, 10:28:40)
> [GCC 4.1.0] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import PyLucene
> [New Thread 32769 (LWP 16082)]
> [New Thread 16386 (LWP 16083)]
>>>> PyLucene.System.gc()
>>>>> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 16386 (LWP 16083)]
> GC_local_malloc_atomic (bytes=58)
> at ../../../gcc-4.1.0/boehm-gc/pthread_support.c:331
> 331 ptr_t my_entry = *my_fl;
> (gdb) bt
> #0 GC_local_malloc_atomic (bytes=58)
> at ../../../gcc-4.1.0/boehm-gc/pthread_support.c:331
> #1 0xb659b632 in _Jv_AllocString (len=19) at java-gc.h:57
> #2 0xb65d6842 in _Jv_NewStringLatin1 (bytes=0xb7e629ba "Bad file 
> descriptor",
> len=19) at cni.h:42
> #3 0xb65ce039 in gnu::java::nio::channels::FileChannelImpl::implCloseChannel 
> (
> this=0x168ac8) at cni.h:60
> #4 0xb682bbc9 in java.nio.channels.spi.AbstractInterruptibleChannel.close() 
> (
> this=0x168ac8) at AbstractInterruptibleChannel.java:79
> #5 0xb6655f7e in gnu.java.nio.channels.FileChannelImpl.finalize() (
> this=0x168ac8) at FileChannelImpl.java:158
> #6 0xb65d3d3d in _Jv_FinalizeObject (obj=0x168ac8)
> at ../../../gcc-4.1.0/libjava/java/lang/natObject.cc:121
> #7 0xb65de5ee in call_finalizer (obj=0x168ac8, client_data=0xb65d3d20)
> at ../../../gcc-4.1.0/libjava/boehm.cc:527
> #8 0xb6bd2812 in GC_invoke_finalizers ()
> at ../../../gcc-4.1.0/boehm-gc/finalize.c:787
> #9 0xb65de9b4 in _Jv_RunFinalizers ()
> at ../../../gcc-4.1.0/libjava/boehm.cc:540
> #10 0xb65c8cd3 in gnu::gcj::runtime::FinalizerThread::run (this=0xdc640)
> at ../../../gcc-4.1.0/libjava/gnu/gcj/runtime/natFinalizerThread.cc:60
> #11 0xb65d883b in _Jv_ThreadRun (thread=0xdc640)
> at ../../../gcc-4.1.0/libjava/java/lang/natThread.cc:297
> #12 0xb65e0060 in really_start (x=0x14aff8)
> at ../../../gcc-4.1.0/libjava/posix-threads.cc:432
> #13 0xb7f9318e in pthread_start_thread () from /lib/libpthread.so.0
> #14 0xb7f93334 in pthread_start_thread_event () from /lib/libpthread.so.0
> #15 0xb7e146ea in clone () from /lib/libc.so.6
> (gdb)
>> the my_fl variable seems bogus indeed:
>> (gdb) p my_fl
> 1ドル = (ptr_t *) 0x40
> (gdb)
>
Trying to proceed, I changed the code in java/nio/channels/natFileChannelPosix.cc
to say:
void
FileChannelImpl::implCloseChannel (void)
{
 jint save = fd;
 fd = -1;
 ::close (save);
}
instead of throwing an exception.
The simple System.gc() invocation no longer causes the process to crash but 
running a more involved test the process crashes as before, in the same 
place, but with a different stack trace when run in gdb:
(gdb) r test/test_Sort.py
Starting program: /usr/local/bin/python test/test_Sort.py
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 12583)]
[New Thread 32769 (LWP 12586)]
[New Thread 16386 (LWP 12587)]
.....
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16386 (LWP 12587)]
GC_local_gcj_malloc (bytes=36, ptr_to_struct_containing_descr=0xb7081cc8)
 at ../../../gcc-4.1.0/boehm-gc/pthread_support.c:371
371 ptr_t my_entry = *my_fl;
(gdb) bt
#0 GC_local_gcj_malloc (bytes=36, ptr_to_struct_containing_descr=0xb7081cc8)
 at ../../../gcc-4.1.0/boehm-gc/pthread_support.c:371
#1 0xb65ffbca in _Jv_AllocObjectNoFinalizer (klass=0xb7081d00) at 
java-gc.h:46
#2 0xb68d4c8a in java.util.WeakHashMap.internalAdd(java.lang.Object, 
java.lang.Object) (this=0x4b6690, key=0xdc640, value=0xdad30) at 
WeakHashMap.java:678
#3 0xb68d4d8f in java.util.WeakHashMap.put(java.lang.Object, 
java.lang.Object)
 (this=0x4b6690, key=0xdc640, value=0xdad30) at WeakHashMap.java:786
#4 0xb68d9b30 in java.util.Collections$SynchronizedMap.put(java.lang.Object, 
java.lang.Object) (this=0x5157e0, key=0xdc640, value=0xdad30)
 at Collections.java:3391
#5 0xb68477c0 in java.lang.ThreadLocal.set(java.lang.Object) (this=0x512210,
 value=0xdad30) at ThreadLocal.java:167
#6 0xb74b3a23 in org.apache.lucene.index.SegmentReader.finalize() (
 this=0x437500) at TermVectorsReader.java:166
#7 0xb6637cdd in _Jv_FinalizeObject (obj=0x437500)
 at ../../../gcc-4.1.0/libjava/java/lang/natObject.cc:121
#8 0xb664258e in call_finalizer (obj=0x437500, client_data=0xb6637cc0)
 at ../../../gcc-4.1.0/libjava/boehm.cc:527
#9 0xb6c367b2 in GC_invoke_finalizers ()
 at ../../../gcc-4.1.0/boehm-gc/finalize.c:787
#10 0xb6642954 in _Jv_RunFinalizers ()
 at ../../../gcc-4.1.0/libjava/boehm.cc:540
#11 0xb662ccd3 in gnu::gcj::runtime::FinalizerThread::run (this=0xdc640)
 at ../../../gcc-4.1.0/libjava/gnu/gcj/runtime/natFinalizerThread.cc:60
#12 0xb663c7db in _Jv_ThreadRun (thread=0xdc640)
 at ../../../gcc-4.1.0/libjava/java/lang/natThread.cc:297
#13 0xb6644000 in really_start (x=0x14aff8)
 at ../../../gcc-4.1.0/libjava/posix-threads.cc:432
#14 0xb7f9318e in pthread_start_thread () from /lib/libpthread.so.0
#15 0xb7f93334 in pthread_start_thread_event () from /lib/libpthread.so.0
#16 0xb7e146ea in clone () from /lib/libc.so.6
(gdb)
Andi..


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /