Java 1.5 pauses my PC for some seconds regularly

Java 1.5.0 causes most other PC tasks including the mouse on my Win2000 box to pause for some seconds regularly, whenever Java performs some CPU or IO intensive task. (Can’t tell the exact reason so far).
In such cases, read: frequently, the taskmanager’s CPU load icon on the systray goes 100% and most other PC tasks are being paused for 1-3 seconds. Even the mouse pointer can’t be moved!
This happens oftently, for example every time I compile (with JBuilder), start a Java app like JEdit or my own projects, etc.

Older JVMs (inlcuding 1.42) don’t do this on the same PC.
Also other native tasks don’t pause the PC.
So I’m wondering how Java 1.5 can hog the system that much?

What tasks would it be?.. looking at the description its impossible to guess whats going on…

[quote]What tasks would it be?.. looking at the description its impossible to guess whats going on…
[/quote]
When I start JEdit, for example.
Or when I start JBuilder.
Or when I hit the compile button in any JBuilder project.
Or when I start my OpenGL game project which loads and binds many textures.

In all the cases the CPU load goes 100% and the mouse pauses for 1/2/3 secs (like most native tasks, too), after that you can move the mouse for some seconds, then again it pauses, etc, until the Java 1.5 app is completely loaded or running for several secs.

The system doesn’t hang: you can still toggle Num lock, Alt-Tab switch apps, etc, and also the Java app causing all this is running happily, but several native tasks (including the mouse) “pauses”…

{Edit} “java -Xincgc” to use the incremental gc, improves the situation for JEdit and my own task somewhat, but the pause effect is still there. Just for JBuilder either it doesn’t make any difference or JBuilder doesn’t accept this switch.

I am beginning to suspect that something is happening in DirectDraw and the current crop of drivers. If Java grabs some kind of DD handle at an inopportune moment and then decides to do something lengthy it may prevent anyone else getting it, and hence the system feels like it’s hung. I may be wrong. But it’s quite serious.

Cas :slight_smile:

Well, to rule out possible ddraw issues, run your app with ddraw disabled: -Dsun.java2d.noddraw=true …

I tried the switch but the pauses still have been there.

The -Xincgc switch so far makes the pauses at startup and JB-compile-time mildly. If I am correct the CPU load never reaches 100% then.
{Edit} When Java 1.5 (re-) allocates memory on my PC it looks like it pauses most of the other PC tasks for a moment. Accordingly, when I start my app with -Xms128M -Xmx128M (to prevent allocating as long as possible) the app runs practically smooth for a long time…

As said, with Java prior to 1.5 on the same PC there are no pauses. Also with other memory hungry native apps (OO for example) I don’t see any pauses.

[quote]Well, to rule out possible ddraw issues, run your app with ddraw disabled: -Dsun.java2d.noddraw=true …
[/quote]
As an aside we have just discovered that ddraw can use a lot of address space — 256MB. Even worse the area used reduced the size of the largest free space from over 500MB to less than 250MB, which caused us grief when requesting a mapping of that size.

My suspicions also fall on GDI drivers… which I am beginning to think might just be using DDraw under the hood now…

…perhaps you could try using the OpenGL pipeline and see if it gets any better? (Assuming that the GL pipeline entirely takes over the entire 2D window rendering pipeline). Turn off native decorations on the window to be sure as well.

Cas :slight_smile:

[quote]…perhaps you could try using the OpenGL pipeline and see if it gets any better?
[/quote]
I tried Dsun.java2d.opengl=true but the pauses still have been there.

Regularly they’re not 2 or 3 sec long but shorter, still easily noticeable.
Java 1.5 is the only application on my PC which pauses the entire PC.

I suspect it’s the memory usage (because -Xincgc as well as large start heap help a lot) but I’ve absolutely no idea what’s the problem.

I notice Eclipse does it a lot, and that’s all GDI based widgets. Hmm.

Cas :slight_smile:

[quote]As an aside we have just discovered that ddraw can use a lot of address space — 256MB.
[/quote]
Wow Mark, that’s excellent information. Thank you.

God bless,
-Toby Reyelts

[quote]I notice Eclipse does it a lot, and that’s all GDI based widgets. Hmm.
[/quote]
Eclipse with Java 1.5 does cause a lot of these mentioned “pauses” on your PC ?
That’s interesting. So does JBuilder (as I said) any my Jogl app when loading textures… However JBuilder is Swing based.

Now if we could find out what behaviour these “pausing” applications share…
I start to dislike the pauses a lot. :frowning:

Anybody else noticed this behaviour?

Does it also happen with some trivial program that doesn’t use any awt, swing and such. A benchmark, for example?

Yeah, now I think about it, Super Elvis seems to exhibit this behaviour too on occasion. Something the VM does is causing some system-wide interruption, and it’s new in 1.5. Maybe Azeem could find out if anything’s changed under the hood? I consider it to be a pretty serious problem as it affects the entire system, not just making the Java apps jerky…

Cas :slight_smile:

You can also run your app with -verbose:gc and see if the pauses correspond to GCs…

[quote]Super Elvis seems to exhibit this behaviour too on occasion. Something the VM does is causing some system-wide interruption, and it’s new in 1.5. (…)
I consider it to be a pretty serious problem as it affects the entire system, not just making the Java apps jerky…
[/quote]
Ok, so now we’ve got two cases describing exactly the same behaviour: the “pause” effect. So it’s not my PC which is being weird or such, I guess.

I see it on all machines using 1.5 and Windows XP and diverse video cards.

Cas :slight_smile:

[quote]I see it on all machines using 1.5 and Windows XP and diverse video cards.
[/quote]
Ok, good to know, so it’s hardly some exotic combination of hardware component A with B and some software component C…

I’ve just rebooted the Win2K box (which I do rarely) and currently the pause effect is very mild: the mouse doesn’t pause currently, a few native apps do - when there’s some Java 1.5 CPU intensive task.
Strange. I’ll try to find out when it goes in “always pause” mode again.

Some fragementation problem? Accumulation?

The ONLY thing that can slow the mouse pointer down in NT is contention for either graphics card or interrupt whilst in kernel mode. This means that something in Java is grabbing exclusive access for a lengthy period in kernel mode. Not good.

Cas :slight_smile:

Not good, indeed.
Even worse than gurgling sound.