This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Small example of livelock regression in garbage collector for GCJ 3.3 under Win32


>  > Compile the program below. It will livelock under 3.3,
>  > with 3.2 it does not livelock.
> 
> I can not reproduce this with i686-linux-gnu.  How long does
> it take? 

Try with 1000 threads.

>What _exactly_ are the symptoms of this "livelock"?

It runs for a short time(couple of seconds):

c:\eclipse\workspace\TestSerial>testit
thread #0  0
thread #0  1000aaaa
thread #0  2000bbbbbc
thread #2  0
thread #2  1000b
thread #2  2000aaaa
thread #2  3000ca
thread #2  4000b
thread #1  0
thread #3  0
thread #3  1000cccccb
thread #1  1000a
thread #2  5000aab
thread #1  2000ab
thread #0  3000b
thread #1  3000aa
thread #2  6000ba
--- stops here



More clues:

- I modified the number of threads to 2 and it didn't stop. It appears
to be more likely to stop the more threads I add. Is thread creation
somehow involved?
- I attached to a livelocked program and here is some debug output:


c:\>gdb
GNU gdb 5.1.1 (mingw experimental)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "mingw32".
(gdb) attach 2644
Attaching to process 2644
[Switching to thread 2644.0xf50]
(gdb) symbol c:\\eclipse\\workspace\\testserial\\testit.exe
Reading symbols from c:\eclipse\workspace\testserial\testit.exe...done.
(gdb) thread apply all bt

Thread 7 (thread 2644.0xf50):
#0  0x77f767ce in _libwsock32_a_iname ()
#1  0x77f7285c in _libwsock32_a_iname ()

Thread 6 (thread 2644.0x1358):
#0  0x7ffe0304 in ?? ()
#1  0x77f7561d in _libwsock32_a_iname ()
#2  0x00413bd5 in gnu::gcj::runtime::FinalizerThread::finalizerReady()
()
#3  0x00451ad8 in GC_notify_or_invoke_finalizers ()
#4  0x0042cb21 in GC_generic_malloc ()
#5  0x0042cc93 in GC_malloc_atomic ()
#6  0x004028d3 in _Jv_AllocPtrFreeObject ()
#7  0x0040ecc0 in _Jv_AllocString ()
#8  0x0040ecf6 in _Jv_NewString ()
#9  0x00401526 in Test.replaceAll(java.lang.String, java.lang.String,
java.lang.
String) (this=0xc1bd70, in=0x1250ef0, a=0x1250ed0, b=0xbe3f90) at
Test.java:9
#10 0x00401d16 in Test.stressGB(java.lang.String) (this=0xc1bd70,
    thread=0x1250f80) at Test.java:87
#11 0x0040134e in Test$1.run() (this=0x1250f70) at Test.java:56
#12 0x00407341 in java::lang::Thread::run() ()
#13 0x00418f37 in _Jv_ThreadRun(java::lang::Thread*) ()
#14 0x00418512 in _Z12really_startPv@4 ()
---Type <return> to continue, or q <return> to quit---
#15 0x0045e64f in thread_start@4 ()
#16 0x77e7d33b in _libwsock32_a_iname ()

Thread 5 (thread 2644.0x1194):
#0  0x7ffe0304 in ?? ()
#1  0x77f7561d in _libwsock32_a_iname ()
#2  0x00413bd5 in gnu::gcj::runtime::FinalizerThread::finalizerReady()
()
#3  0x00451ad8 in GC_notify_or_invoke_finalizers ()
#4  0x0042cb21 in GC_generic_malloc ()
#5  0x0042cc93 in GC_malloc_atomic ()
#6  0x004028d3 in _Jv_AllocPtrFreeObject ()
#7  0x0040ecc0 in _Jv_AllocString ()
#8  0x0040ecf6 in _Jv_NewString ()
#9  0x00401526 in Test.replaceAll(java.lang.String, java.lang.String,
java.lang.
String) (this=0xc1bd70, in=0x128de70, a=0x128de50, b=0xbe3f90) at
Test.java:9
#10 0x00401d16 in Test.stressGB(java.lang.String) (this=0xc1bd70,
    thread=0x1250fe0) at Test.java:87
#11 0x0040134e in Test$1.run() (this=0x1250fd0) at Test.java:56
#12 0x00407341 in java::lang::Thread::run() ()
#13 0x00418f37 in _Jv_ThreadRun(java::lang::Thread*) ()
#14 0x00418512 in _Z12really_startPv@4 ()
#15 0x0045e64f in thread_start@4 ()
#16 0x77e7d33b in _libwsock32_a_iname ()
---Type <return> to continue, or q <return> to quit---

Thread 4 (thread 2644.0x17fc):
#0  0x7ffe0304 in ?? ()
#1  0x77f7561d in _libwsock32_a_iname ()
#2  0x00413bd5 in gnu::gcj::runtime::FinalizerThread::finalizerReady()
()
#3  0x00451ad8 in GC_notify_or_invoke_finalizers ()
#4  0x0042cb21 in GC_generic_malloc ()
#5  0x0042cc93 in GC_malloc_atomic ()
#6  0x00402a32 in _Jv_NewPrimArray ()
#7  0x00406dce in gnu::gcj::runtime::StringBuffer::StringBuffer(int) ()
#8  0x00406d99 in gnu::gcj::runtime::StringBuffer::StringBuffer() ()
#9  0x00401a08 in Test.stressGB(java.lang.String) (this=0xc1bd70,
    thread=0xc1bd20) at Test.java:78
#10 0x0040134e in Test$1.run() (this=0xc1bd10) at Test.java:56
#11 0x00407341 in java::lang::Thread::run() ()
#12 0x00418f37 in _Jv_ThreadRun(java::lang::Thread*) ()
#13 0x00418512 in _Z12really_startPv@4 ()
#14 0x0045e64f in thread_start@4 ()
#15 0x77e7d33b in _libwsock32_a_iname ()

Thread 3 (thread 2644.0x1474):
#0  0x7ffe0304 in ?? ()
#1  0x77f7561d in _libwsock32_a_iname ()
---Type <return> to continue, or q <return> to quit---
#2  0x00413bd5 in gnu::gcj::runtime::FinalizerThread::finalizerReady()
()
#3  0x00451ad8 in GC_notify_or_invoke_finalizers ()
#4  0x0042cb21 in GC_generic_malloc ()
#5  0x0042cc93 in GC_malloc_atomic ()
#6  0x004028d3 in _Jv_AllocPtrFreeObject ()
#7  0x0040ecc0 in _Jv_AllocString ()
#8  0x0040ecf6 in _Jv_NewString ()
#9  0x00401526 in Test.replaceAll(java.lang.String, java.lang.String,
java.lang.
String) (this=0xc1bd70, in=0x12ac030, a=0x12ac010, b=0xbe3f90) at
Test.java:9
#10 0x00401d16 in Test.stressGB(java.lang.String) (this=0xc1bd70,
    thread=0xc1bd50) at Test.java:87
#11 0x0040134e in Test$1.run() (this=0xc1bd40) at Test.java:56
#12 0x00407341 in java::lang::Thread::run() ()
#13 0x00418f37 in _Jv_ThreadRun(java::lang::Thread*) ()
#14 0x00418512 in _Z12really_startPv@4 ()
#15 0x0045e64f in thread_start@4 ()
#16 0x77e7d33b in _libwsock32_a_iname ()

Thread 2 (thread 2644.0x15f8):
#0  0x77f60bee in _libwsock32_a_iname ()
#1  0x00e2fa0c in ?? ()
#2  0x77fb4dbd in _libwsock32_a_iname ()
#3  0x0041022c in _Jv_FinalizeObject(java::lang::Object*) ()
---Type <return> to continue, or q <return> to quit---
#4  0x00417b1f in call_finalizer(void*, void*) ()
#5  0x00451a8b in GC_invoke_finalizers ()
#6  0x00413cd5 in gnu::gcj::runtime::FinalizerThread::run() ()
#7  0x00418f37 in _Jv_ThreadRun(java::lang::Thread*) ()
#8  0x00418512 in _Z12really_startPv@4 ()
#9  0x0045e64f in thread_start@4 ()
#10 0x77e7d33b in _libwsock32_a_iname ()

Thread 1 (thread 2644.0x102c):
#0  0x7ffe0304 in ?? ()
#1  0x77e7ac21 in _libwsock32_a_iname ()
#2  0x00403a16 in _Jv_RunMain(java::lang::Class*, char const*, int, char
const**
, bool) ()
#3  0x00403b4f in JvRunMain ()
#4  0x004012e2 in main (argc=1, argv=0x3d3d60)
    at C:/DOCUME~1/oyvind/LOCALS~1/Temp/cc0Ecaaa.i:11
#0  0x77f767ce in _libwsock32_a_iname ()
(gdb)
(gdb)


>I take it that this is a null pointer exception.  Presumably 
>throwing any exception here would do the same thing.  Did you tyr?

I tried with "throw new Exception();". No livelock.

Øyvind


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]