Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, February 2008
Java VM crashes after closing the application (a QSettings problem?)


Message 1 in thread

Hi everyone,
I use QSettings to store the current state of various settings in my 
application but for some reason my VM started crashing when I closed my 
program.
After reading up on the various problems that can cause a VM crash and 
trying out the most common fixes (using the Java HotSpot Client VM 
instead of the Server one, use -Xcheck:jni as VM argument) I came to the 
conclusion that I should post the problem here because the last native 
code instruction on the stack was from "libqtjambi.so.1.0.0".

I include the last few echos I received from the -verbose commands and 
an excerpt from the error log file.

best regards
Florian


------------------------------------------------------

VM arguments:
-verbose -verbose:jni -verbose:gc -Xcheck:jni -Xfuture -client

(-server creates the same error just at a different address:
# V  [libjvm.so+0x43a6f5]
instead of
# V  [libjvm.so+0x292af5]
as found in this log)

After closing the program I get the following:


.
.
.
[Dynamic-linking native method 
com.trolltech.qt.QtJambi_LibraryShutdown.run_helper ... JNI]
[Loaded java.util.prefs.FileSystemPreferences$11 from 
/afs/psi.ch/user/h/huebner/java/jre1.5.0_14/lib/rt.jar]
[Loaded java.util.prefs.FileSystemPreferences$13 from 
/afs/psi.ch/user/h/huebner/java/jre1.5.0_14/lib/rt.jar]
[Loaded java.util.prefs.FileSystemPreferences$12 from 
/afs/psi.ch/user/h/huebner/java/jre1.5.0_14/lib/rt.jar]
[Dynamic-linking native method 
java.io.UnixFileSystem.setLastModifiedTime ... JNI]
[Dynamic-linking native method 
java.util.prefs.FileSystemPreferences.unlockFile0 ... JNI]
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  SIGSEGV (0xb) at pc=0xb7a44af5, pid=21727, tid=3086326464
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing)
# Problematic frame:
# V  [libjvm.so+0x292af5]
#
# An error report file with more information is saved as hs_err_pid21727.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#





The matching hs_err_pid21727.log file starting after the information above:


---------------  T H R E A D  ---------------

Current thread is native thread

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0x00000000

Registers:
EAX=0xbfa8cee0, EBX=0xb7b3f34c, ECX=0x0000003e, EDX=0xb7b0b8de
ESP=0xbfa8cecc, EBP=0xbfa8d6b8, ESI=0x00000000, EDI=0x00000000
EIP=0xb7a44af5, CR2=0x00000000, EFLAGS=0x00210286

Top of Stack: (sp=0xbfa8cecc)
0xbfa8cecc:   00000000 00000000 00000000 00000000
0xbfa8cedc:   0000003e 41544146 5245204c 20524f52
0xbfa8ceec:   6e206e69 76697461 656d2065 646f6874
0xbfa8cefc:   7355203a 20676e69 45494e4a 6920766e
0xbfa8cf0c:   6f6e206e 614a2d6e 74206176 61657268
0xbfa8cf1c:   00000a64 00000000 00000000 00000000
0xbfa8cf2c:   00000000 00000000 00000000 00000000
0xbfa8cf3c:   00000000 00000000 00000000 00000000

Instructions: (pc=0xb7a44af5)
0xb7a44ae5:   00 52 e8 a4 fe ff ff 8b 8d 24 f8 ff ff 83 c4 1c
0xb7a44af5:   8b 16 51 50 56 ff 52 04 83 c4 10 8d 65 f8 5b 5e

Stack: [0xbf891000,0xbfa91000),  sp=0xbfa8cecc,  free space=2031k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, 
C=native code)
V  [libjvm.so+0x292af5]
V  [libjvm.so+0x1aa3c7]
C  [libqtjambi.so.1.0.0+0x1da1c] 
_Z21qMetaTypeDeleteHelperI14JObjectWrapperEvPT_+0x4c
C  [libQtCore.so.4+0x117e13]  _ZN9QMetaType7destroyEiPv+0x143
C  [libQtCore.so.4+0x129dc6]
C  [libQtGui.so.4+0x1de02b]
C  [libQtCore.so.4+0x12ff49]  _ZN8QVariantD1Ev+0x49
C  [libQtGui.so.4+0x378320]  _ZN4QMapIi8QVariantE8freeDataEP8QMapData+0x30
C  [libQtGui.so.4+0x3782ee]  _ZN4QMapIi8QVariantED1Ev+0x3e
C  [libQtGui.so.4+0x768d10] 
_ZN4QMapIPK13QGraphicsItemS_Ii8QVariantEE8freeDataEP8QMapData+0x30
C  [libQtGui.so.4+0x768cde] 
_ZN4QMapIPK13QGraphicsItemS_Ii8QVariantEED1Ev+0x3e
C  [libQtGui.so.4+0x76810f]
C  [libc.so.6+0x2b8c9]  exit+0xe9
C  [libc.so.6+0x15df4]  __libc_start_main+0xe4


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
   0x0885c828 JavaThread "Thread-0" daemon [_thread_blocked, id=21743]
   0x0852fba8 JavaThread "Low Memory Detector" daemon [_thread_blocked, 
id=21738]
   0x0852e5f8 JavaThread "CompilerThread0" daemon [_thread_blocked, 
id=21737]
   0x0852d680 JavaThread "Signal Dispatcher" daemon [_thread_blocked, 
id=21736]
   0x08526c80 JavaThread "Finalizer" daemon [_thread_blocked, id=21735]
   0x08525f68 JavaThread "Reference Handler" daemon [_thread_blocked, 
id=21734]

Other Threads:

VM state:at safepoint (shutting down)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x084e66a0/0x084e66c8] Threads_lock - owner thread: 0x08524b18

Heap
  def new generation   total 576K, used 43K [0x88f00000, 0x88fa0000, 
0x893e0000)
   eden space 512K,   8% used [0x88f00000, 0x88f0ac18, 0x88f80000)
   from space 64K,   0% used [0x88f80000, 0x88f80000, 0x88f90000)
   to   space 64K,   0% used [0x88f90000, 0x88f90000, 0x88fa0000)
  tenured generation   total 6184K, used 3710K [0x893e0000, 0x899ea000, 
0x8cf00000)
    the space 6184K,  59% used [0x893e0000, 0x8977f968, 0x8977fa00, 
0x899ea000)
  compacting perm gen  total 8192K, used 5932K [0x8cf00000, 0x8d700000, 
0x90f00000)
    the space 8192K,  72% used [0x8cf00000, 0x8d4cb1d8, 0x8d4cb200, 
0x8d700000)
     ro space 8192K,  64% used [0x90f00000, 0x91431750, 0x91431800, 
0x91700000)
     rw space 12288K,  48% used [0x91700000, 0x91cc9178, 0x91cc9200, 
0x92300000)

Dynamic libraries:
.
.
.


Message 2 in thread

Florian Hübner wrote:
> I use QSettings to store the current state of various settings in my 
> application but for some reason my VM started crashing when I closed 
> my program.
> After reading up on the various problems that can cause a VM crash and 
> trying out the most common fixes (using the Java HotSpot Client VM 
> instead of the Server one, use -Xcheck:jni as VM argument) I came to 
> the conclusion that I should post the problem here because the last 
> native code instruction on the stack was from "libqtjambi.so.1.0.0".
>
> I include the last few echos I received from the -verbose commands and 
> an excerpt from the error log file.

Hi, Florian.

I think I may already have a fix for this, but I need to try to 
reproduce the bug to be sure, so I have some questions to try to get an 
overview:

1. Does this only happen when your QSettings code is active? (if you 
comment out all the code that writes or reads to QSettings and run the 
application otherwise unchanged, will the crash disappear?)
2. Precisely what types are you storing in QSettings? Do each of these 
support the Serializable interface?
3. Does the crash by any chance disappear if you add the following code 
at the end of your main() method:

    if (QApplication.instance() != null) QApplication.instance().dispose();

Also, of course, any code sample which reproduces the crash would be 
extremely helpful.

-- Eskil


Message 3 in thread

> 1. Does this only happen when your QSettings code is active? (if you 
> comment out all the code that writes or reads to QSettings and run the 
> application otherwise unchanged, will the crash disappear?)

That was the case before, but somehow something else must have snuck 
into the code and now it happens even after commenting everything out.

> 2. Precisely what types are you storing in QSettings? Do each of these 
> support the Serializable interface?

QByteArray and String
String certainly does and my guess would be that QByteArray does the same.

> 3. Does the crash by any chance disappear if you add the following code 
> at the end of your main() method:
> 
>    if (QApplication.instance() != null) QApplication.instance().dispose();
> 

No

> Also, of course, any code sample which reproduces the crash would be 
> extremely helpful.

I will try to narrow it down once my schedule allows it again. Hope I 
can be of more help then.