Slow graphics/animation in Java, Xorg uses 100% cpu

Bug #250931 reported by Lucas Dixon
86
This bug affects 11 people
Affects Status Importance Assigned to Milestone
sun-java6 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Ubuntu 8.04 on Lenovo T60p, also happens in Ubuntu 8.10 (Intrepid Ibex)

seems to be kernel independent

happens for me with:
...$ lspci | grep VGA
01:00.0 VGA compatible controller: ATI Technologies Inc M56GL [Mobility FireGL V5200]

The problem happens with all java implementations: java-1.5.0-sun, java-6-sun, and java-6-openjdk
The problem happens with fglx as well as with the standard (unaccelerated) driver

sun-java6-jre:
  Installed: 6-06-0ubuntu1
  Candidate: 6-06-0ubuntu1
  Version table:
 *** 6-06-0ubuntu1 0
        500 http://gb.archive.ubuntu.com hardy/multiverse Packages
        100 /var/lib/dpkg/status

Bug has been present since release of Ubuntu 8.04.

Graphics/animation in java are often horribly slow (depends on application, but is consistent). This is not the case on Ubuntu 7.X, or earlier versions. It also not the case on other distributions. It is not the case on all other machines, so it may be something about the graphics driver and this graphics card. This happens with all versions of Java, so I suspect the bug is in some library that java is talking to, maybe xulrunner? I tested this on another machine, using an intel graphics card (Intel Mobile GM965/GL960) and the same version of ubuntu and java - it did not show the same bug. So it may also be something to do with ATI and X.

Attached below (bad-linux-java.tgz) is a small and simple example java program that goes wrong. On distributions with working java, the icon moves to the location of the mouse smoothly. On Ubuntu 8.04, on my T60p, it moves jerkily and slowly; I get aprox 1 frame every couple of seconds; on working machines it's as much as 60.
(to run the example java program in the attachment, simply run the shell script "foo"). Looking at "top" output shows that Xorg uses 100% of CPU.

This causes severe problems for use of processing (www.processing.org) as well as many other java based programs and thus also webpages. I suspect this may be the culprit for several other misunderstood java related bugs.

Tags: lucid
Revision history for this message
Lucas Dixon (iislucas) wrote :
Lucas Dixon (iislucas)
description: updated
description: updated
Lucas Dixon (iislucas)
description: updated
Revision history for this message
Gabriel Thörnblad (gabriel-thornblad) wrote :

I can confirm this behavior, I also have an ATI graphics controller:
ATI Technologies Inc M24 1P [Radeon Mobility X600]
and have not been able to run any graphic intense java applications in Ubuntu 8.04.

The good news is that java graphics in Intrepid Beta works fine for me, so I will just stick with that.

Revision history for this message
Gabriel Thörnblad (gabriel-thornblad) wrote :

Well, maybe I was too quick to say that it works "fine" in Intrepid. I still cannot get java to use the OpenGL-pipeline, but at least performance is much better. The example Lucas provided actually looks smooth in Intrepid Beta, but draws quite a lot of CPU. Far from perfect, but at least usable.

Revision history for this message
julienc (jcastelain) wrote :

Hi,

I'm having the same problem especially with processing (I'm running ubuntu 8.10 and sun-java6), eclipse runs fine, I didn't try any java applets yet, but this is kinda driving me mad cause the main tool I work with is processing

I also tried installing sun-java5-jdk and jre but no luck, and on my desktop which is runnig 8.0.4 installing the jdk solved the problem,

Is there any workaround to get this working properly?
Any help would be appreciated

Thanks
Julien

Revision history for this message
Ricardo Almeida (ric-almeida) wrote :

julienc wrote on 2008-12-20: (permalink)

> Is there any workaround to get this working properly?
> Any help would be appreciated

I installed openjdk instead of sun-java...

Revision history for this message
julienc (jcastelain) wrote :

Thanks for the feedback Ricardo, I'll try the open jdk, in the meantime uninstalling the ATI Drivers that come with Ubuntu 8.10 solved my problem with processing. It runs smoothly as expected

Cheers

Revision history for this message
Lucas Dixon (iislucas) wrote :

Neither ubuntu 8.10, nor open jdk, nor ATI drivers solve the problem on my machine (IBM thinkpad T60p).

description: updated
Revision history for this message
Artem Baguinski (femistofel) wrote :

Ubuntu 8.10, proprietary ATI driver.

I can confirm Processing rendering slow using its default renderer, but fast using P2D, P3D or OPENGL (when adding one of those as a third parameter to size() call). I tested it on Lucas' example.

On the other hand, jgears ( http://trac-hg.assembla.com/jgears ) runs smoothly at about 40 fps. Does it mean it's processing issue and not so much java's?

Revision history for this message
sreque (seanthenewt) wrote :

I am seeing this problem on 8.10 with the NVIDIA accelerated graphics driver version 177. Openoffice is especially sluggish, and when I view CPU usage in top, Xorg is reported to be the culprit.

Revision history for this message
bberto (roberto84) wrote :

Same problem here. I have Ubuntu 8.10, ATI Radeon X1600 with opensource (radeon) or ATI fglrx accellerated driver.

Processing with default renderer (JAVA 2D) is inusable. Openoffice, Netbeans and others Java software are quite slow when rendering graphics.

Revision history for this message
lifo (lifofernandez) wrote :

Here with Nvidia drivers v96 i have the exact same problem.
Processing with OpenGL runs very very fast, but "less beauty" than the default render witch is too slow for work.
¿is there any way to get a prettier OpenGL rendering?
¿does anybody knows about this problem and Ubuntu 9.10? ¿is it solved?

Revision history for this message
Chris Bainbridge (chris-bainbridge) wrote :

I find the openstreetmap editor JOSM amazingly slow at times e.g. taking 5 seconds to respond to a mouse click. It is possible that some JOSM functions are slow, or the JVM itself is slow, but my suspicion was that the software rendering might be to blame.

When I start JOSM with "java -Dsun.java2d.opengl=True -jar ~/osm/josm-latest.jar"
I get the error: "Could not enable OpenGL pipeline for default config on screen 0".

This occurs in Ubuntu Jaunty with all latest patches, running on a Thinkpad T42p with "ATI FireGL Mobility T2 (M10) NT (AGP)" chipset (i.e. mobile Radeon 9600). Other standard GLX/DRI 3D applications work, but trying to enable 2D OpenGL acceleration for Java does not.

I wonder if the other posters in this bug are seeing the same error enabling the Java OpenGL pipeline?

Revision history for this message
sly (liste-letuffe) wrote :

I have the same problem on Debian Lenny as well.
With fresh compiled radeon drivers :

drivers :
(II) Module radeon: vendor="X.Org Foundation"
compiled for 1.4.2, module version = 6.12.99

board :
ATI Technologies Inc RV280 [Radeon 9200 SE]

The problem didn't occured in etch with default drivers (or was really less
unnoying)
I haven't found other non-java application with the problem yet, so it has
to do with radeon+java

Running with "vesa" xorg driver solves the problem, but it's not a solution.

I'm also a josm user and got the same message as you do.

Note that I've managed to ease my pain a bit with http://www.linuxinsight.com/your-ati-radeon-very-slow-on-xorg-x-server-1.3.html
But I don't feel it really solves the core problem

Revision history for this message
Alex Pinder (la-dend) wrote :

I'm a Java developer and first noticed this bug when I was testing my software on Ubuntu machines, initially I thought it was my code so thank goodness it's someone else's code.

Some things to add; I've run the OpenJDK and Sun Java 6 and both seem to be buggy however, if I run the Java software without the jar file IE - directly through the class files things seem to run smoothly. Could this be something to do with the way the jar is decompressed?

Revision history for this message
Mark M. (earlmagnus) wrote :

I'm having this problem on Lucid and notice it when a presenter flips slides in a Sametime Unyte meeting.

tags: added: lucid
Revision history for this message
zzart (zzart999) wrote :

i can confirm it as well - ubuntu 9/ thinkpad R61 / nvidia drivers 185 . it always happen when i have any extra effects enabled . the P3D and OPENGL work al right in processing but otherwise JAVA2D crashes my entire gdm (screen starts flickering and everything becomes unusable ) .
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)
but as far as i can remember it was doing it also on recent OpenJDK.
any chance of sorting out this bustard ?:)

Revision history for this message
Jason (sirjasonr) wrote :

Also affecting me in Lucid. Terrible times running Eclipse, and often run into troubles with openoffice.org.

Revision history for this message
zzart (zzart999) wrote :

hi
ive done some searching and updated my java version from 1.6.0.15 to 1.6.0.20 (apparently the 15v was really buggy ?:). for anyone wanting to do it in ubuntu 9.10 and ubuntu in general this is the link http://sites.google.com/site/easylinuxtipsproject/java
i can confirm that the problem has dissapeared and i default JAVA2D for processing with nvidia drivers enabled in 9.10 ubuntu is working correct.

Revision history for this message
zzart (zzart999) wrote :

small edit to my last post.... after using it for some time i ve still expienced some crashes . they happen seldomly but still gdm restart is requred in most cases. :(

Revision history for this message
eric (eric-ericaro) wrote :

Hi,

I've just executed the bad-linux-java program, a windows do start, but after let say half a second, gdm fully crashes (black screen and back to the login screen).

my lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)

my glxinfo|grep render
direct rendering: Yes
OpenGL renderer string: Mesa DRI Intel(R) 965GM GEM 20091221 2009Q4 x86/MMX/SSE2

runing on Karmic

and, BTW, java is very slow in my computer.

Revision history for this message
eric (eric-ericaro) wrote :

edit: sorry:

running on Lucid Lynx

Revision history for this message
Michael Zijlstra (mzijlstra) wrote :

Hi,

I can also confirm this bug running ubuntu 10.4, Sun Java 1.6.0_20-b02, ATI Radeon HD 4350.

Eclipse often freezes up for a couple of seconds, using 100% CPU, and Java2D animation is always jerky / choppy.

Strangely enough, it seems that moving the mouse around over the window seems to smooth out the animation problems, found this as a recommendation to fix animation at (http://forums.java.net/jive/thread.jspa?threadID=38821&tstart=0)

They also recommend using Toolkit.getDefaultToolkit().sync(); in the animation loop to try and sync every frame. Unfortunately this does not seem to work, as also confirmed by several people at (http://kenai.com/jira/browse/TRIDENT-2).

Changed in sun-java6 (Ubuntu):
status: New → Confirmed
Revision history for this message
Nikoleta Verbeck (nerdynick) wrote :

After updating to 11.11 running Gnome-shell (Gnome 3) I started having this same issue. I've tried both lightdm and gdm as other bugs lead me to believe it might be an issue with LightDM. My problem is more Eclipse acting sluggish running against Sun Java 6.

Has anyone found a work around until this can get fixed?

Revision history for this message
penalvch (penalvch) wrote :
Changed in sun-java6 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.