JDK-4948515 : solaris x86: random IllegalArgumentException: Non-positive averageCharsPerByte
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.2_02
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: x86
  • Submitted: 2003-11-04
  • Updated: 2003-11-16
  • Resolved: 2003-11-16
Related Reports
Duplicate :  
Description
This may be a duplicate of a bug filed against the hashtable class with the same jvm/system
(I'm not sure where to access the sun.nio classes, so I can not be 100% sure). Please close it
out if it is related. Without looking at thesun.nio.*  code I can't tell if a bad value is passed
in from the the nio charset code or somehow the value was changing between calls (which appeared 
to be happening in the related bug) so I'm filing it initially against nio

see 4948500

We only saw this specific problem once in ~ 24 hours, so it may not be easy to duplicate 
 ...I will add a smaller test case if we are able to duplicate it outside our product.

The problem was seen while running a stress/longevity test on SunONE Message Queue 3.5
(I can provide information on how to run the stress/longevity test if necessary and/or
provide access to the system)


System information:
    OS:     SunOS 5.9 x86
   hardware:  v60x, 2x2.8GHz Xeon 2GB
   JDK:  java version "1.4.2_02"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
          Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)

System was unable to load in a properties file, because an IllegalArgumentException 

After reviewing the code, we are loading the system using the standard load api:

    public synchronized void load(InputStream inStream) throws IOException {

so our code is not passing in a bad value ...


[02/Nov/2003:14:25:54 PST] ERROR [B3100]: Unexpected Broker Internal Error : [Uncaught Exception] :
com.sun.messaging.jmq.jmsserver.util.BrokerException: [B4117]: Unexpected Broker Exception: [Unexpected Error processi
ng message]
        at com.sun.messaging.jmq.jmsserver.data.PacketRouter.accessControlCheck(PacketRouter.java:204)
        at com.sun.messaging.jmq.jmsserver.data.PacketRouter.handleMessage(PacketRouter.java:141)
        at com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection.readData(IMQConnection.java:1737)
        at com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection.process(IMQConnection.java:785)
        at com.sun.messaging.jmq.jmsserver.service.imq.OperationRunnable.process(OperationRunnable.java:135)
        at com.sun.messaging.jmq.jmsserver.util.pool.BasicRunnable.run(BasicRunnable.java:455)
        at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalArgumentException: Non-positive averageCharsPerByte
        at java.nio.charset.CharsetDecoder.<init>(CharsetDecoder.java:172)
        at java.nio.charset.CharsetDecoder.<init>(CharsetDecoder.java:203)
        at sun.nio.cs.ISO_8859_1$Decoder.<init>(ISO_8859_1.java:52)
        at sun.nio.cs.ISO_8859_1$Decoder.<init>(ISO_8859_1.java:49)
        at sun.nio.cs.ISO_8859_1.newDecoder(ISO_8859_1.java:42)
        at sun.nio.cs.StreamDecoder$CharsetSD.<init>(StreamDecoder.java:357)
        at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:73)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:83)
        at java.util.Properties.load(Properties.java:266)
        at com.sun.messaging.jmq.jmsserver.auth.acl.JMQFileAccessControlModel.load(JMQFileAccessControlModel.java:108)
        at com.sun.messaging.jmq.jmsserver.auth.acl.JMQFileAccessControlModel.checkDestinationPermission(JMQFileAccess
ControlModel.java:182)
        at com.sun.messaging.jmq.jmsserver.auth.JMQAccessControlContext.checkDestinationPermission(JMQAccessControlCon
text.java:124)
        at com.sun.messaging.jmq.jmsserver.auth.AccessController.checkDestinationPermission(AccessController.java:411)
        at com.sun.messaging.jmq.jmsserver.data.PacketHandler.checkPermission(PacketHandler.java:201)
        at com.sun.messaging.jmq.jmsserver.data.PacketHandler.checkPermission(PacketHandler.java:113)
        at com.sun.messaging.jmq.jmsserver.data.PacketRouter.accessControlCheck(PacketRouter.java:184)
        ... 6 more

Comments
WORK AROUND -XX:UseSSE=0
11-06-2004

EVALUATION in sun.nio.cs.ISO_8859_1.java: private static class Decoder extends CharsetDecoder { private Decoder(Charset cs) { super(cs, 1.0f, 1.0f); } apprently it passes two floats of 1.0 to java.nio.CharsetDecoder(...), and java.nio.charset.CharsetDecoder(in Charset-X-coder.java): {#if[encoder]?protected:private} Charset$Coder$(Charset cs, float average$ItypesPerOtype$, float max$ItypesPerOtype$, $replType$ replacement) { this.charset = cs; if (average$ItypesPerOtype$ <= 0.0f) throw new IllegalArgumentException("Non-positive " + "average$ItypesPerOtype$"); if (max$ItypesPerOtype$ <= 0.0f) throw new IllegalArgumentException("Non-positive " + "max$ItypesPerOtype$"); this.replacement = replacement; this.average$ItypesPerOtype$ = average$ItypesPerOtype$; this.max$ItypesPerOtype$ = max$ItypesPerOtype$; replaceWith(replacement); } the condition of if (average$ItypesPerOtype$ <= 0.0f) becomes true. This bug is almost the same as 4948500, and they have common: both happen in constructors. According to description, it might be platform related jit problem. ###@###.### 2003-11-06
06-11-2003