JDK-4648626 : Exception thrown and infinite loop in java2demo with remote display
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.0,1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2002-03-07
  • Updated: 2002-10-21
  • Resolved: 2002-10-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2 mantisFixed
Related Reports
Relates :  
Description
I found this while testing.  It occurs in Merlin as well as Hopper.  

It only occurs when rlogged into jano (Solaris 2.6) and displaying 
back to my machine (gradgrind - solaris 2.7) - not when I run it at 
the console on gradgrind.  

The problem occurs on the Composite tab.  It may be attempting to 
transfer to the next tab (Font) when the exception is thrown.  
Here is my output:  

echawkes@jano:/home/echawkes( 41 )% setenv DISPLAY gradgrind:0.0   
echawkes@jano:/home/echawkes( 42 )% /java/jdk/bin/jdkx -r 1.4 java2demo 
cd /usr/local/java/jdk1.4/solsparc/demo/jfc/Java2D
/usr/local/java/jdk1.4/solsparc/bin/java -jar Java2Demo.jar -runs=1 -delay=5 -ccthread

Java2D Demo RunWindow : 1 Runs, 5 second delay between tabs
java version: 1.4.0
SunOS 5.6

#0 Wed Mar 06 17:55:58 PST 2002, 4757.0547K used
sun.dc.pr.PRException: endPath: bad path
        at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
        at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
        at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
        at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49)
        at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2190)
        at java.awt.font.ShapeGraphicAttribute.draw(ShapeGraphicAttribute.java:134)
        at sun.awt.font.GraphicComponent.handleDraw(GraphicComponent.java:224)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndEmbellishments(Decoration.java:236)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndDecorations(Decoration.java:301)
        at sun.awt.font.GraphicComponent.draw(GraphicComponent.java:231)
        at java.awt.font.TextLine.draw(TextLine.java:495)
        at java.awt.font.TextLayout.draw(TextLayout.java:2666)
        at java2d.demos.Fonts.AttributedStr.render(AttributedStr.java:134)
        at java2d.Surface.paint(Surface.java:325)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4735)
        at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
        at javax.swing.JComponent._paintImmediately(JComponent.java:4632)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4464)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:404)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
sun.dc.pr.PRException: endPath: bad path
        at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
        at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
        at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
        at sun.java2d.pipe.DuctusShapeRenderer.draw(DuctusShapeRenderer.java:45)
        at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2162)
        at sun.awt.font.Underline$StandardUnderline.drawUnderline(Underline.java:157)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndEmbellishments(Decoration.java:259)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndDecorations(Decoration.java:301)
        at sun.awt.font.ExtendedTextSourceLabel.draw(ExtendedTextSourceLabel.java:116)
        at java.awt.font.TextLine.draw(TextLine.java:495)
        at java.awt.font.TextLayout.draw(TextLayout.java:2666)
        at java2d.demos.Fonts.AttributedStr.render(AttributedStr.java:134)
        at java2d.Surface.paint(Surface.java:325)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4735)
        at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
        at javax.swing.JComponent._paintImmediately(JComponent.java:4632)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4464)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:404)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
sun.dc.pr.PRException: endPath: bad path
        at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
        at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
        at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
        at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49)
        at sun.java2d.pipe.ValidatePipe.fill(ValidatePipe.java:119)
        at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2190)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndDecorations(Decoration.java:297)
        at sun.awt.font.ExtendedTextSourceLabel.draw(ExtendedTextSourceLabel.java:116)
        at java.awt.font.TextLine.draw(TextLine.java:495)
        at java.awt.font.TextLayout.draw(TextLayout.java:2666)
        at java2d.demos.Fonts.AttributedStr.render(AttributedStr.java:134)
        at java2d.Surface.paint(Surface.java:325)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintChildren(JComponent.java:643)
        at javax.swing.JComponent.paint(JComponent.java:813)
        at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4735)
        at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4688)
        at javax.swing.JComponent._paintImmediately(JComponent.java:4632)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4464)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:404)
        at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:443)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
sun.dc.pr.PRException: endPath: bad path
        at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
        at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
        at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
        at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49)
        at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:2190)
        at java.awt.font.ShapeGraphicAttribute.draw(ShapeGraphicAttribute.java:134)
        at sun.awt.font.GraphicComponent.handleDraw(GraphicComponent.java:224)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndEmbellishments(Decoration.java:236)
        at sun.awt.font.Decoration$DecorationImpl.drawTextAndDecorations(Decoration.java:301)
        at sun.awt.font.GraphicComponent.draw(GraphicComponent.java:231)


and so on.... 



Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mantis FIXED IN: mantis INTEGRATED IN: mantis
14-06-2004

EVALUATION This seems to be a fonts problem. The demo that throws the exception is java2d.demos.Fonts.AttributedStr . The exception is thrown only when the application is run remotely, even with the pixmaps support disabled: [tdv@jano:] -< demo/jfc/Java2D > #>../../../bin/java -Dsun.java2d.pmoffscreen=false -cp Java2Demo.jar sun.dc.pr.PRException: endPath: bad path at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537) at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374) at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57) at sun.java2d.pipe.DuctusShapeRenderer.fill(DuctusShapeRenderer.java:49) ... Also, I can't reproduce it on local display with the pixmaps turned on and dga/shared memory turned off (to simulate the remote display situation). So the problem is probably in the way we use fonts when running remotely. Reassigning to fonts engineer. ###@###.### 2002-03-11 ======================================== I think we are passing out of bounds values because TextLayout is misbehaving. Its happening when remote displaying but I don't know why yet. The following simple program import java.awt.*; import java.awt.font.*; public class BB { public static void main(String args[]) { FontRenderContext frc = new FontRenderContext(null, false, false); Font font = new Font("dialog", Font.PLAIN, 12); TextLayout tl = new TextLayout("str", font, frc); //System.out.println(tl.toString()); System.err.println("bhgt="+ tl.getBounds().getHeight()); System.err.println("asc="+ tl.getAscent()); System.err.println("dsc="+ tl.getDescent()); System.err.println("ldg="+ tl.getLeading()); } } prints this displaying remotely :- bhgt=-3.4028234663852886E38 asc=12.0 dsc=4.0 ldg=1.0 but a sensible value when displaying locally, or with the headless toolkit. ###@###.### 2002-03-11 ============================ This can be reproduced in varying ways all the way back to JDk 1.2. ###@###.### 2002-04-17 ================================ We have seen a new manifestation of this which I have tracked down. When a strike is created it is created through a cache, The constructor (hsGGlyphStrike::hsGGlyphStrike) first ask the scaler to count the number of glyphs in the font and if that is > 0 it initialises the metrics. The flaw is that if font initialisation failed for some reason (and fGlyphCount is 0) then the metrics are never initialised. Subsequent client queries then retrieve random uninitialised values. I believe this is the underlying cause of all of these problems. They are typically seen remotely because that is when we tend to run into problems where fonts that are expected to be found aren't found. For many fonts it isn't a problem because we can fall back to using T2K rather than the Xserver (if we were using the Xserver at all). But for fonts which were not located as files then there is no fall back and we hit this bug. In this case a problem arose displaying from Solaris to Linux because the font properties now explicitly mapped F3 fonts that previously would have just "not found". a "default" font would have been substituted. Its probably worth noting that not finding these fonts means that historically almost all remote displays from Solaris to any system *other* than Solaris would trigger a "loadfonts()" [[ASIDE: The loadfonts is triggered because null is returned by a call in initTerminalNames() to getFileNameFromPlatformName(). Fixing that requires reworking some code structure so that it would not do the loadfonts where it was not going to help. ie it will not help if it was a native font and the display is remote. It may still help if its a remote display and the font is file-based. So you can only avoid loadfonts when you know that it is a native-only font and that you will not be able to set the X font path to locate any more fonts than are already located]]. The simple fix is to initialise the metrics to 0 values. This then treats these fonts as having no glyphs and "zero" metrics. A more complete fix is to discard the useless composite slot or to replace it with a targetted substitute. Substituting the default font (dialog) as was currently happening is questionable since dialog uses the components that weren't found. We should also examine if the new code fixed under 4321790 should try to handle this. It could try to determine if a native font that is "mapped" by explicit font properties entries is actually available via native APIs and subsitute a default if it isn't. ###@###.### 2002-10-15 ============================
15-10-2002