Qt-jambi-interest Archive, November 2006
Another crash
Message 1 in thread
I seem to get some of these when I use the Invokable class we discussed
earlier to ensure that Jambi stuff is run in the correct thread.
Sometimes this is called from the Jambi thread allready, but the code
could also be triggered outside Jambi, so it must be there.
I enclose the Invokable class for reference.
public abstract class Invokable extends QObject {
public Invokable() {
moveToThread(QApplication.instance().thread());
}
public boolean event(QEvent e) {
if (e.type() == resolve(User.value() + 1)) {
invoked();
disposeLater();
return true;
} else {
return super.event(e);
}
}
public abstract void invoked();
public static void invoke(Invokable inv) {
QApplication.postEvent(inv, new QEvent(resolve(User.value() + 1)));
}
Regards,
Helge Fredriksen
#
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6503c8fb, pid=1364, tid=7032
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode)
# Problematic frame:
# C [QtGui4.dll+0x3c8fb]
#
--------------- T H R E A D ---------------
Current thread (0x000389b0): JavaThread "main" [_thread_in_native, id=7032]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000000
Registers:
EAX=0x0007f5d0, EBX=0x00000000, ECX=0x00000000, EDX=0x0b4fc0b4
ESP=0x0007f4fc, EBP=0x00000000, ESI=0x0c188b30, EDI=0x00000000
EIP=0x6503c8fb, EFLAGS=0x00010206
Top of Stack: (sp=0x0007f4fc)
0x0007f4fc: 0c1cb250 00000199 0b2e2448 0007f548
0x0007f50c: 00000012 00000012 0b41c8d1 0007f548
0x0007f51c: 00000000 0007f5d0 6530d45a ffffffff
0x0007f52c: 65025885 0b2eb890 0007f598 0007f5b0
0x0007f53c: 00000000 00000000 00000000 000002c5
0x0007f54c: 00000199 65037348 0007f598 0007f598
0x0007f55c: 0b42aac1 0007f598 0b2e0214 0b2eb890
0x0007f56c: 00000002 6502673f 0007f598 0b2e0214
Instructions: (pc=0x6503c8fb)
0x6503c8eb: 30 65 50 64 89 25 00 00 00 00 83 ec 20 55 8b e9
0x6503c8fb: 8b 45 00 56 8b 75 04 ff 10 3b 86 d0 00 00 00 0f
Stack: [0x00040000,0x00080000), sp=0x0007f4fc, free space=253k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [QtGui4.dll+0x3c8fb]
[error occurred during error reporting, step 120, id 0xc0000005]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.trolltech.qt.gui.QApplication.exec()I+0
j com.poseidon.rescue.client.student.StudentApp.main([Ljava/lang/String;)V+60
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0b9695e0 JavaThread "UDP Thread (Pool 9)" [_thread_blocked, id=4464]
0x00bd0608 JavaThread "UDP Thread (Pool 8)" [_thread_blocked, id=7744]
0x0b9e89f0 JavaThread "UDP Thread (Pool 7)" [_thread_blocked, id=4436]
0x0b9516d8 JavaThread "UDP Thread (Pool 6)" [_thread_blocked, id=1700]
0x0b9e6420 JavaThread "UDP Thread (Pool 5)" [_thread_blocked, id=3064]
0x0b135580 JavaThread "UDP Thread (Pool 4)" [_thread_blocked, id=4916]
0x0b10d410 JavaThread "UDP Thread (Pool 3)" [_thread_blocked, id=6532]
0x0b115400 JavaThread "UDP Thread (Pool 2)" [_thread_blocked, id=4440]
0x0b9d5a68 JavaThread "UDP Thread (Pool 1)" [_thread_blocked, id=6260]
0x0b9eacd8 JavaThread "UDP Thread (Pool 0)" [_thread_blocked, id=4888]
0x00bcadd8 JavaThread "UDP cleanup thread" [_thread_blocked, id=5084]
0x0b13d0a8 JavaThread "UID - Receiver Thread" [_thread_in_native, id=4400]
0x0b0f6690 JavaThread "Thread-1" [_thread_blocked, id=7836]
0x0af98300 JavaThread "Thread-0" daemon [_thread_blocked, id=7868]
0x00c2f390 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4796]
0x00c2db90 JavaThread "CompilerThread0" daemon [_thread_blocked, id=7540]
0x00c2ca08 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5648]
0x00c2af88 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=7316]
0x00c29bf8 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=7384]
0x00039210 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=6748]
0x00c198f0 JavaThread "Finalizer" daemon [_thread_blocked, id=7172]
0x00c18450 JavaThread "Reference Handler" daemon [_thread_blocked, id=7648]
=>0x000389b0 JavaThread "main" [_thread_in_native, id=7032]
Other Threads:
0x00c15ab8 VMThread [id=1220]
0x00c49fc0 WatcherThread [id=5932]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 453K [0x02c60000, 0x02d00000, 0x03140000)
eden space 512K, 76% used [0x02c60000, 0x02cc1570, 0x02ce0000)
from space 64K, 100% used [0x02cf0000, 0x02d00000, 0x02d00000)
to space 64K, 0% used [0x02ce0000, 0x02ce0000, 0x02cf0000)
tenured generation total 2368K, used 1737K [0x03140000, 0x03390000, 0x06c60000)
the space 2368K, 73% used [0x03140000, 0x032f2770, 0x032f2800, 0x03390000)
compacting perm gen total 8448K, used 8230K [0x06c60000, 0x074a0000, 0x0ac60000)
the space 8448K, 97% used [0x06c60000, 0x07469a70, 0x07469c00, 0x074a0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x0040d000 C:\Program Files\Java\jdk1.5.0_07\bin\java.exe
0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x6d730000 - 0x6d8c7000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\client\jvm.dll
0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0x10000000 - 0x10063000 C:\WINDOWS\system32\wxvault.dll
0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x71b20000 - 0x71b32000 C:\WINDOWS\system32\MPR.dll
0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x003e0000 - 0x003e5000 C:\WINDOWS\system32\detoured.dll
0x7c9c0000 - 0x7d1d5000 C:\WINDOWS\system32\SHELL32.dll
0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\comctl32.dll
0x00a00000 - 0x00a17000 C:\Program Files\Common Files\Logitech\LVMVFM\LVPrcInj.dll
0x6d2f0000 - 0x6d2f8000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\hpi.dll
0x6d3f0000 - 0x6d425000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\jdwp.dll
0x6d700000 - 0x6d70c000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\java.dll
0x6d720000 - 0x6d72f000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\zip.dll
0x6d290000 - 0x6d297000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\dt_socket.dll
0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
0x0ac60000 - 0x0ac96000 C:\WINDOWS\system32\biolsp.dll
0x77a80000 - 0x77b14000 C:\WINDOWS\system32\CRYPT32.dll
0x77b20000 - 0x77b32000 C:\WINDOWS\system32\MSASN1.dll
0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
0x71a50000 - 0x71a8f000 C:\WINDOWS\system32\mswsock.dll
0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
0x67000000 - 0x67152000 C:\WINDOWS\system32\QtCore4.dll
0x7c3a0000 - 0x7c41b000 C:\WINDOWS\system32\MSVCP71.dll
0x7c340000 - 0x7c396000 C:\WINDOWS\system32\MSVCR71.dll
0x0b1a0000 - 0x0b1c0000 C:\WINDOWS\system32\qtjambi.dll
0x65000000 - 0x654f3000 C:\WINDOWS\system32\QtGui4.dll
0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.dll
0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
0x0b1d0000 - 0x0b24e000 C:\WINDOWS\system32\com_trolltech_qt_core.dll
0x0b390000 - 0x0b687000 C:\WINDOWS\system32\com_trolltech_qt_gui.dll
0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
0x0b6e0000 - 0x0b84f000 C:\WINDOWS\system32\nview.dll
0x77690000 - 0x776b1000 C:\WINDOWS\system32\NTMARTA.DLL
0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
0x71bf0000 - 0x71c03000 C:\WINDOWS\system32\SAMLIB.dll
0x10100000 - 0x1010f000 C:\Program Files\Logitech\SetPoint\lgscroll.dll
0x78130000 - 0x781cb000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd\MSVCR80.dll
0x7c420000 - 0x7c4a7000 C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.42_x-ww_0de06acd\MSVCP80.dll
0x6d530000 - 0x6d543000 C:\Program Files\Java\jdk1.5.0_07\jre\bin\net.dll
0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll
0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll
0x66210000 - 0x66219000 C:\WINDOWS\system32\netware\NWWS2NDS.DLL
0x50d50000 - 0x50d98000 C:\WINDOWS\system32\NETWIN32.DLL
0x50d00000 - 0x50d15000 C:\WINDOWS\system32\CLNWIN32.DLL
0x50df0000 - 0x50e10000 C:\WINDOWS\system32\LOCWIN32.DLL
0x50db0000 - 0x50ddb000 C:\WINDOWS\system32\NCPWIN32.dll
0x71ad0000 - 0x71ad9000 C:\WINDOWS\system32\WSOCK32.dll
0x66220000 - 0x6622c000 C:\WINDOWS\system32\netware\NWWS2SLP.DLL
0x66250000 - 0x66257000 C:\WINDOWS\system32\NWSRVLOC.dll
0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll
0x74d90000 - 0x74dfb000 C:\WINDOWS\system32\usp10.dll
0x20000000 - 0x202c5000 C:\WINDOWS\system32\xpsp2res.dll
0x0bf40000 - 0x0bf55000 C:\WINDOWS\system32\nvwddi.dll
VM Arguments:
jvm_args: -Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:2688,suspend=y,server=n -Dfile.encoding=windows-1252
java_command: com.poseidon.rescue.client.student.StudentApp
Launcher Type: SUN_STANDARD
Environment Variables:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\WINDOWS\system32\nls\ENGLISH;c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin;c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;c:\Program Files\Java\jdk1.5.0_07\jre\bin;c:\Qt\4.2.0\bin;
USERNAME=Helge
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 14 Stepping 8, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows XP Build 2600 Service Pack 2
CPU:total 2 family 6, cmov, cx8, fxsr, mmx, sse, sse2, ht
Memory: 4k page, physical 2095216k(683260k free), swap 4033396k(2680752k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_07-b03) for windows-x86, built on May 3 2006 01:04:38 by "java_re" with MS VC++ 6.0
Message 2 in thread
Helge Fredriksen wrote:
> I seem to get some of these when I use the Invokable class we discussed
> earlier to ensure that Jambi stuff is run in the correct thread.
> Sometimes this is called from the Jambi thread allready, but the code
> could also be triggered outside Jambi, so it must be there.
>
> I enclose the Invokable class for reference.
Hi Helge,
In Technology Preview 3 we have
QApplication.invokeLater(java.lang.Runnable r);
for this exact purpose ;-)
--
[ signature omitted ]
Message 3 in thread
I seem to have found the root of the most of these crashes. I think it's
because
I wasn't careful enough initializing the QObjects in the Jambi thread.
Cleaning up
in this seem to have fixed it. Then, when I tried to access these objects
(and
possibly do some Qt GUI stuff on them) through ordinary GUI operations (like
scaling
the window) things just crashed. I did get some warning before the crash
that
"One shouldn't issue exceptions in a qt event handler" or something like
that.
I have cleaned up my code now, but you'll probably want to handle these
coding
errors better than a VM crash...
Helge F.
On 11/14/06, Gunnar Sletta <gunnar@xxxxxxxxxxxxx> wrote:
>
> Helge Fredriksen wrote:
> > I seem to get some of these when I use the Invokable class we discussed
> > earlier to ensure that Jambi stuff is run in the correct thread.
> > Sometimes this is called from the Jambi thread allready, but the code
> > could also be triggered outside Jambi, so it must be there.
> >
> > I enclose the Invokable class for reference.
>
> Hi Helge,
>
> In Technology Preview 3 we have
>
> QApplication.invokeLater(java.lang.Runnable r);
>
> for this exact purpose ;-)
>
> --
>
> I'm not aware of any location where this patterns breaks though, so
> could you share some more details?
>
> best regards,
> Gunnar
>
Message 4 in thread
Helge Fredriksen wrote:
> I seem to have found the root of the most of these crashes. I think
> it's because I wasn't careful enough initializing the QObjects in the
> Jambi thread. Cleaning up in this seem to have fixed it. Then, when I
> tried to access these objects (and possibly do some Qt GUI stuff on
> them) through ordinary GUI operations (like scaling the window)
> things just crashed. I did get some warning before the crash that
> "One shouldn't issue exceptions in a qt event handler" or something
> like that.
Was it:
QtJambi: Exception pending in native code
?
I can't find the error message above in the source codes...
Anyway, could you be a bit more specific in how to reproduce the errors.
If I know what is wrong I can try to avoid crashes for this usecase? Are
you creating all your objects in the main thread or are your QObjects
created in different threads?
Is your RMI thread calling methods on QObjects created in the main thread?
> I have cleaned up my code now, but you'll probably want to handle
> these coding errors better than a VM crash...
Indeed we do. Our goal is to have zero potential for VM crash by the
time we release, so this kind of feedback is essential ;-)
best regards,
Gunnar
Message 5 in thread
Helge Fredriksen wrote:
> I seem to have found the root of the most of these crashes. I think
> it's because I wasn't careful enough initializing the QObjects in the
> Jambi thread. Cleaning up in this seem to have fixed it. Then, when I
> tried to access these objects (and possibly do some Qt GUI stuff on
> them) through ordinary GUI operations (like scaling the window)
> things just crashed. I did get some warning before the crash that
> "One shouldn't issue exceptions in a qt event handler" or something
> like that.
> I have cleaned up my code now, but you'll probably want to handle
> these coding errors better than a VM crash...
Seems we may be able to solve this problem for most cases. The problem
that occurs is most likely that you are accessing a QObject in one
thread and using it in the other. This is violation of the QObject
thread affinity, so we added some extra checks to the generated Java
code that checks if your accessing the object from the correct thread,
otherwise it will throw a QThreadAffinityException. You'll also get the
option of disabling this for performance reasons using the runtime option:
-Dcom.trolltech.qt.thread-check=false
to the virtual machine.
This will be part of the _next_ release of Qt Jambi, so I hope this
helps solve your problems ;-)
-
Gunnar