Java Swing display stops updating until an X event is generated

EDIT: more information at the end

I have a (large) Java Swing application that exhibits very strange behavior. If the computer running on it remains inactive (without a mouse or keyboard) for a sufficiently long time (ranging from one hour or so to several days), the Swing display sometimes completely stops updating completely (we have, among other things, a clock displayed on the screen that stop updating) until the user moves the mouse. Once the mouse has been moved, our application works fine. (Creating and deleting a window from another application also causes the display to start updating again, keyboard input does not seem sufficient.)

We run Sun JDK 1.6.0_07 on the Linux kernel 2.6.25.14 (I think this is a modified RHEL 4 distribution, but I'm not sure about that), running xorg-x11-server 1.1.1-48.13.e15.

When in this state the AWT event queue is always "Runnable" and in one of several methods java2d is the most recent example that I have:

at sun.java2d.loops.Blit.Blit (native method)
at sun.java2d.pipe.DrawImage.blitSurfaceData
at sun.java2d.pipe.DrawImage.renderImageCopy
at sun.java2d.pipe.DrawImage.copyImage
at sun.java2d.pipe.DrawImage.copyImage
at sun.java2d.pipe.ValidatePipe.copyImage
at sun.java2d.SunGraphics2D.drawImage
at sun.java2d.SunGraphics2D.drawImage
at <our code>

And the stack trace from GDB for this thread looks like this:

in poll()
in XAddConnectionWatch()
in _XRead()
in _XReply()
in XSync()
in X11SD_GetRasInfo()
in Java_sun_java2d_loops_Blit_Blit
in ??

In addition, our application usually has a couple of threads that display VolatileImages in the background. When in this state, these threads are always RUNNABLE, but get stuck in calls like:

at sun.java2d.loops.FillRect.FillRect (Native Method)
at sun.java2d.pipe.LoopPipe.fillRect
at sun.java2d.SunGraphics2D.fillRect
at sun.java2d.SunGraphics2D.clearRect
at <our code: rendering to a VolatileImage>

and the GDB stack trace for these threads:

in pthread_cond_wait@@GLIBC_2.3.2
in Monitor::wait
in GC_locker::jni_lock_slow
in jni_GetPrimitiveArrayCritical
in BufImg_GetRasInfo
in Java_sun_java2d_loops_FillRect_FillRect
in ??

Has anyone seen anything like this before? We are completely shocked, and I'm not even sure what to do next to try to identify the problem.

EDIT: . AWT , JStack, gdb; , , , .

!

+3
1

, - Java2D, , , , - - .

, AWT ( , ), , , , - , , .

, , , , WorkerThread, - , .

+2

Source: https://habr.com/ru/post/1731564/


All Articles