Hallo zusammen,
ich habe ein JFrame, dass Runnable implementiert. In der run-Methode läuft eine Endlosschleife, in der alle 15 Sekunden eine Funktion aufgerufen wird (siehe Quellcode). Das Programm beendet sich ganz willkürlich, machmal nach ein paar Tagen, manchmal nach wenigen Minuten. Dabei wird eine Fehler-Datei "hs_err_pidXXX.log" erzeugt (siehe unten). Was mache ich falsch?
Die erzeugte Fehlerdatei enthält das Folgende:
ich habe ein JFrame, dass Runnable implementiert. In der run-Methode läuft eine Endlosschleife, in der alle 15 Sekunden eine Funktion aufgerufen wird (siehe Quellcode). Das Programm beendet sich ganz willkürlich, machmal nach ein paar Tagen, manchmal nach wenigen Minuten. Dabei wird eine Fehler-Datei "hs_err_pidXXX.log" erzeugt (siehe unten). Was mache ich falsch?
Code:
public class ParserFrame extends JFrame implements Runnable{
private JLabel statusLabel;
private JPanel southPanel;
private JProgressBar bar;
private Thread t;
private boolean run=false;
public ParserFrame(){
setTitle("Test");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
southPanel = new JPanel();
southPanel.setLayout(new GridLayout(1,1));
statusLabel = new JLabel("working ...");
southPanel.add(statusLabel);
bar = new JProgressBar();
this.bar.setStringPainted(true);
southPanel.add(bar);
getContentPane().add(southPanel, BorderLayout.SOUTH);
pack();
setSize(500, 500);
setVisible(true);
t = new Thread(this);
t.start();
}
//******************************************************************************
public void run() {
run = true;
try {
while (run) {
doSomething();
// wait 15 seconds, then start again
int amount = 15;
for(int sec=0; sec<amount;sec++){
if(run){
statusLabel.setText("idle for "+(amount-sec)+" seconds ");
Thread.sleep(1000);
}else{
sec = 15; // -> exit loop
}
}
}
this.dispose();
System.exit(0);
} catch (InterruptedException e) {
String msg = "Thread-Fehler!";
JOptionPane.showMessageDialog( null, msg+"\n"+e );
ErrorLogger.logError(msg+"\n"+e);
run = false;
System.exit(0);
}
}
//******************************************************************************
public void doSomething(){
...
}
}
Code:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d12f0d9, pid=788, tid=3892
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0_01-b06 mixed mode)
# Problematic frame:
# C [awt.dll+0x12f0d9]
#
# If you would like to submit a bug report, please visit:
# [url]http://java.sun.com/webapps/bugreport/crash.jsp[/url]
#
--------------- T H R E A D ---------------
Current thread (0x0ae25400): JavaThread "Thread-2" [_thread_in_native, id=3892]
siginfo: ExceptionCode=0xc0000005, reading address 0x04090421
Registers:
EAX=0x0ae91968, EBX=0x0aab83bc, ECX=0x0aaadfe0, EDX=0x04090409
ESP=0x0b2bf70c, EBP=0x00000000, ESI=0x0ae254e8, EDI=0x003758b0
EIP=0x6d12f0d9, EFLAGS=0x00010246
Top of Stack: (sp=0x0b2bf70c)
0x0b2bf70c: 0ae254e8 6d1303f9 00000001 0b2bf72c
0x0b2bf71c: 0ae25400 06d1d908 0b2bf774 06d1d908
0x0b2bf72c: 00000000 00000000 00000000 00000000
0x0b2bf73c: 008ca460 0ae254e8 0b2bf788 00000001
0x0b2bf74c: 02e39738 029882f8 0b2bf754 00000000
0x0b2bf75c: 0b2bf788 06d1e540 00000000 06d1d908
0x0b2bf76c: 00000000 0b2bf784 0b2bf7ac 008c2dd7
0x0b2bf77c: 00000000 008c8436 00000001 029882f8
Instructions: (pc=0x6d12f0d9)
0x6d12f0c9: 69 fb ff 8b 4c 24 08 8b 14 88 8b 0d c4 6a 18 6d
0x6d12f0d9: 8b 72 18 e8 8f 69 fb ff 8b c6 5e c3 cc cc cc cc
Stack: [0x0b270000,0x0b2c0000), sp=0x0b2bf70c, free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [awt.dll+0x12f0d9]
[error occurred during error reporting, step 120, id 0xc0000005]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.awt.Win32GraphicsConfig.getBounds(I)Ljava/awt/Rectangle;+0
j sun.awt.Win32GraphicsConfig.getBounds()Ljava/awt/Rectangle;+8
j javax.swing.RepaintManager.getDoubleBufferMaximumSize()Ljava/awt/Dimension;+54
j javax.swing.RepaintManager.getVolatileOffscreenBuffer(Ljava/awt/Component;II)Ljava/awt/Image;+23
j javax.swing.RepaintManager$PaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+23
J javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V
j javax.swing.JComponent.paintForceDoubleBuffered(Ljava/awt/Graphics;)V+41
j javax.swing.JViewport.blitDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Graphics;IIIIIIIIII)V+73
j javax.swing.JViewport.windowBlitPaint(Ljava/awt/Graphics;)Z+269
j javax.swing.JViewport.setViewPosition(Ljava/awt/Point;)V+207
j javax.swing.plaf.basic.BasicScrollPaneUI$Handler.vsbStateChanged(Ljavax/swing/JViewport;Ljavax/swing/event/ChangeEvent;)V+31
j javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(Ljavax/swing/event/ChangeEvent;)V+98
j javax.swing.DefaultBoundedRangeModel.fireStateChanged()V+57
j javax.swing.DefaultBoundedRangeModel.setRangeProperties(IIIIZ)V+130
j javax.swing.DefaultBoundedRangeModel.setValue(I)V+62
j javax.swing.JScrollBar.setValue(I)V+14
j FileParser.<init>(LParserFrame;Ljava/io/File;)V+210
j ParserFrame.parseHl7Files()V+242
j ParserFrame.run()V+9
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x0ae80800 JavaThread "TimerQueue" daemon [_thread_blocked, id=1488]
0x0ae8f000 JavaThread "MySQL Statement Cancellation Timer" daemon [_thread_blocked, id=352]
0x00376000 JavaThread "DestroyJavaVM" [_thread_blocked, id=508]
=>0x0ae25400 JavaThread "Thread-2" [_thread_in_native, id=3892]
0x0ae09800 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=600]
0x0ad83c00 JavaThread "AWT-Windows" daemon [_thread_in_native, id=2808]
0x0ad83000 JavaThread "AWT-Shutdown" [_thread_blocked, id=2776]
0x0aab4000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2472]
0x0aa67c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2468]
0x0aa66400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=608]
0x0aa65000 JavaThread "Attach Listener" daemon [_thread_blocked, id=2524]
0x0aa64400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=612]
0x0aa56400 JavaThread "Finalizer" daemon [_thread_blocked, id=1252]
0x0aa52000 JavaThread "Reference Handler" daemon [_thread_blocked, id=1112]
Other Threads:
0x0aa4f000 VMThread [id=1024]
0x0aa69000 WatcherThread [id=1576]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 960K, used 409K [0x02940000, 0x02a40000, 0x02e20000)
eden space 896K, 38% used [0x02940000, 0x02996738, 0x02a20000)
from space 64K, 100% used [0x02a30000, 0x02a40000, 0x02a40000)
to space 64K, 0% used [0x02a20000, 0x02a20000, 0x02a30000)
tenured generation total 6528K, used 4705K [0x02e20000, 0x03480000, 0x06940000)
the space 6528K, 72% used [0x02e20000, 0x032b8700, 0x032b8800, 0x03480000)
compacting perm gen total 12288K, used 10676K [0x06940000, 0x07540000, 0x0a940000)
the space 12288K, 86% used [0x06940000, 0x073ad388, 0x073ad400, 0x07540000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x00423000 C:\Programme\Java\jre1.6.0_01\bin\javaw.exe
0x7c920000 - 0x7c9e6000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c915000 C:\WINDOWS\system32\kernel32.dll
0x77f30000 - 0x77fdc000 C:\WINDOWS\system32\ADVAPI32.dll
0x77c20000 - 0x77cbf000 C:\WINDOWS\system32\RPCRT4.dll
0x77e20000 - 0x77eb3000 C:\WINDOWS\system32\USER32.dll
0x77bd0000 - 0x77c18000 C:\WINDOWS\system32\GDI32.dll
0x7c340000 - 0x7c396000 C:\Programme\Java\jre1.6.0_01\bin\msvcr71.dll
0x6d7c0000 - 0x6da07000 C:\Programme\Java\jre1.6.0_01\bin\client\jvm.dll
0x76990000 - 0x769be000 C:\WINDOWS\system32\WINMM.dll
0x6d310000 - 0x6d318000 C:\Programme\Java\jre1.6.0_01\bin\hpi.dll
0x76a60000 - 0x76a6b000 C:\WINDOWS\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 C:\Programme\Java\jre1.6.0_01\bin\verify.dll
0x6d3b0000 - 0x6d3cf000 C:\Programme\Java\jre1.6.0_01\bin\java.dll
0x6d7b0000 - 0x6d7bf000 C:\Programme\Java\jre1.6.0_01\bin\zip.dll
0x6d000000 - 0x6d1c3000 C:\Programme\Java\jre1.6.0_01\bin\awt.dll
0x72e90000 - 0x72eb7000 C:\WINDOWS\system32\WINSPOOL.DRV
0x77b70000 - 0x77bca000 C:\WINDOWS\system32\msvcrt.dll
0x76180000 - 0x7619d000 C:\WINDOWS\system32\IMM32.dll
0x774f0000 - 0x77624000 C:\WINDOWS\system32\ole32.dll
0x73690000 - 0x736dc000 C:\WINDOWS\system32\ddraw.dll
0x739c0000 - 0x739c6000 C:\WINDOWS\system32\DCIMAN32.dll
0x6d2b0000 - 0x6d303000 C:\Programme\Java\jre1.6.0_01\bin\fontmanager.dll
0x72550000 - 0x725a1000 C:\WINDOWS\system32\MSCTF.dll
0x7c9f0000 - 0x7d1fd000 C:\WINDOWS\system32\shell32.dll
0x77ec0000 - 0x77f12000 C:\WINDOWS\system32\SHLWAPI.dll
0x77340000 - 0x77443000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.1830_x-ww_7AE38CCF\comctl32.dll
0x6d570000 - 0x6d583000 C:\Programme\Java\jre1.6.0_01\bin\net.dll
0x71a10000 - 0x71a27000 C:\WINDOWS\system32\WS2_32.dll
0x71a00000 - 0x71a08000 C:\WINDOWS\system32\WS2HELP.dll
0x6d590000 - 0x6d599000 C:\Programme\Java\jre1.6.0_01\bin\nio.dll
0x6d220000 - 0x6d243000 C:\Programme\Java\jre1.6.0_01\bin\dcpr.dll
0x71930000 - 0x71972000 C:\WINDOWS\System32\mswsock.dll
0x76dc0000 - 0x76dea000 C:\WINDOWS\system32\DNSAPI.dll
0x76e60000 - 0x76e67000 C:\WINDOWS\System32\winrnr.dll
0x76e00000 - 0x76e2f000 C:\WINDOWS\system32\WLDAP32.dll
0x76e70000 - 0x76e75000 C:\WINDOWS\system32\rasadhlp.dll
0x0b380000 - 0x0b3da000 C:\WINDOWS\system32\hnetcfg.dll
0x718f0000 - 0x718f8000 C:\WINDOWS\System32\wshtcpip.dll
VM Arguments:
java_command: C:\test\Parser0.3.jar
Launcher Type: SUN_STANDARD
Environment Variables:
CLASSPATH=C:\Programme\Java\jre1.6.0_01\lib\ext\mysql-connector-java-5.1.5-bin.jar
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\web\xampp\php
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 43 Stepping 1, AuthenticAMD
--------------- S Y S T E M ---------------
OS: Windows Server 2003 family Build 3790 Service Pack 1
CPU:total 2 family 15, cmov, cx8, fxsr, mmx, sse, sse2, mmxext, 3dnowext, 3dnow, ht
Memory: 4k page, physical 2096552k(1556416k free), swap 4038776k(3644816k free)
vm_info: Java HotSpot(TM) Client VM (1.6.0_01-b06) for windows-x86, built on Mar 14 2007 00:24:02 by "java_re" with unknown MS VC++:1310