This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes GUI Freezing/locking up.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GUI Freezing/locking up...." Watch "GUI Freezing/locking up...." New topic
Author

GUI Freezing/locking up....

Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
I've been working on a what is becoming an ever more and more complex desktop app using swing (something on par with an extremely paired down IDE). And the application is begining to lockup/freeze and I can't really point to any piece of code that is doing it. No exceptions are being thrown, it doesn't seem to rely on any particular events. When the problem occurs my cpu "usage" hits about 50% and stays there. The most reliable way to trigger the happening is simply by scrolling a table (I don't have any listners on the scrollpane).

I wouldn't expect anyone to tell me exactly what the problem is (especially w/o the code and I wouldn't expect anyone to sift through the hundreds/thousands lines anyhow).

But I would love any suggestions for going about debugging such a problem.
I would think the problem is thread lock somewhere, but really the problem started before I created/used any other threads (although I have started to go back and use foxtrot to try to make the gui more responsive).

-Tad
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Note that if the problem is deadlock, CPU usage would be 0 when it was hung, not 50%.

You can get full thread dumps by pressing Ctrl-Break (Windows) or Ctrl-\ (real computers) in the console you launch the program from. Try this when it hangs, have a look at the stack dump, and you'll see where each thread is at that time.


[Jess in Action][AskingGoodQuestions]
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Ok, I did what you said.
I've got a list of threads (about 14 or 15)..
Underneath each thread title is a list of what looks like methods.
like:
at java.lang.String.indexOf(Unkown Source)
....

The stack looks similiar to an exception stack(would the topmost method be the one currently being executed inside of each method listed below?).

Everyonce in awhile I find:
- wating on (0x22f93390) (a java.lang.ref.ReferenceQueue$Lock)

followed a line or so down by:
- locked (0x22f93390) (a java.lang.ref.ReferenceQueue$Lock)

It looks like a memory address? is it waiting for that specific block to be "free" so that it may access it?

The only methods that looked to by my own that were listed in under any of the threads were listed under the awt-event-queue thread... Is there where you would suggest looking for the problem?

Thank you for the information regarding the thread dumps.

-Tad
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Well it looks like the problem was in the methods/innerclass that was listed at the top of the event-queue thread.

Once again thank you.

-Tad
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Tad Dicks:
Well it looks like the problem was in the methods/innerclass that was listed at the top of the event-queue thread.


Great! I love happy endings
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GUI Freezing/locking up....