Desperate bug-hunt

hey all-

I’ve been on wild goose chase for weeks on this nasty little threading bug. Here’s my scenario - our program opens a copy of my renderer (which is in and of itself working fabulously). Then the user does whatever for a minute… and then when the hardware has finished a second data-gathering pass at higher detail, the program closes the first instance of the renderer, and opens a new one in its place. Somehow in that process, we end up deadlocking our event thread. At first i was trying to analytically hunt down the bug. I then left work for a week or so and came back to find my code smothered with so many failed attempts to fix the problem that i’m getting lost in it. So time for a new approach!

Hopefully it’s a reasonable question to ask, what methods are there that are sensitive to threading. Is my problem likely linked to display()? Or is there another critical point I should be checking? Wherever possible, I call repaint() to update my rendering surfaces, but in a few places, it is critical that I use display(), as follows:


for(each chunk of data i need to update){
  setupAllTheVariousParameters();
  pBuffer.display();  // I can't wait on an event queue here; parameters might change before it got processed
}

At this point it seems more productive to me to try and find out what methods are capable of causing this sort of threading issue, and search for them, rather than analyzing my renderer’s control flow top-down. The problem only seems to arise when I have one dialog with rendered stuff already open and try to dispose() it and immediately create a new one.

At least on linux you can press ctrl+\ on the command line to get a complete dump of each thread’s stack, and also identify simple deadlocks (eg: Thread 1 has locked object A and is waiting to lock object B, thread 2 has locked B and is waiting for A)
Something to watch out for with JOGL is that its use of invokeAndWait() to execute on the awt event thread can cause deadlocks that are not identified by this mechanism, you have to manually inspect the dump instead.

In any case, I always find that the ctrl+\ thread dump is a great place to start deadlock-hunting.

holy crap, man. that thing’s awesome!.. (on windows, btw, it’s ctrl+brk, but that’s neither here nor there)… i feel like a man who spent his whole life pounding in nails with a fist… and then discovers the miracle of the hammer.

In other news… I found one obvious deadlock right away. I’ll fix that and see how things look from there. thanks a million!

It’s always a pleasure to help in the battle against prostate troubles. ;D

Speaking of which, your posts make you sound a little ashamed of your work:

[quote]Then the user does whatever for a minute…
[/quote]

[quote]I’ll just let our website do the explaining
[/quote]
You’re fighting the good fight! You should be shouting your achievements from the rooftops! Like so:

[quote]Then the user manipulates the water-cooled probe (which, by the way, is designed for “rectal comfort”) so as to get a better view of the swollen and distended gland
[/quote]

[quote]I visualise anal probes!
[/quote]
If I had your job, I’d probably have that second one on a t-shirt.

…I should probably put as my signature…

[quote]I’ll just let our website do the explaining
[/quote]

[/quote]
Heh; don’t mistake my tone for shame :stuck_out_tongue: It doesn’t bother me any more talking about my work. I just get tired of lengthy explanations, so i usually refer people to the website rather than spend a 1/2 hour explaining what I do. However bad anal probes might sound… believe me when something’s wrong in that department, all the other alternatives are even worse. We get a giggle… but the other stuff some places do instead would give ya shivers.

[quote]I visualize anal probes!
[/quote]
Something to that effect was actually in my IM profile for quite some time :stuck_out_tongue: