[xep-support] wierd bug in sequence-page-master?

Michael Sulyaev msulyaev at renderx.com
Fri Dec 5 08:23:01 PST 2008


ploni almoni wrote:
> I use XEP and occasionally get a strange message complaining that an
> attribute value is invalid (mostly in
> sequence-page-master/layout-master-set: force-page-count,
> blank-or-not-blank). I have validation turned on.

Hi,
The bug appears as an application crash due to unhandled 
               com.renderx.xep.lib.InternalException, which prints
"illegal value for <attribute-name>:<value>",
where the value is actually perfectly valid for the attribute-name.

> The bug only happens once in a while, and I can't reproduce it
> reliably.

I have never seen in appear, but I know it does rarely happen under 
really heavy load (in multiple threads, by several CPUs/cores) during 
really long period of time, like once in a month.

> Does anybody have a similar problem? Any clues how to fix?

Reported on two installations. Since nobody else replied to your 
message, I hope nobody else has this problem.


The reason of this issue has been found in Sun's implementation of 
java.util.WeakHashMap, which appears to be "not fully" thread safe. See 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6425537 .

I suggest to patch this bug in Sun's code and to use the patched version 
while running java.

The patch at the end of this message is for jdk1.6.0_07. One may need to 
get the source code of his version and prepare a similar patch.

Compile the patched file and jar it alone preserving directory structure 
(java/util/) into e.g. WeakHashMap.p6425537.jar. In order to force Java 
to use the patched version (instead of the original version from 
rt.jar), prepend the jar file with the patched class to the boot class 
path using the option -Xbootclasspath/p:/path/to/WeakHashMap.p6425537.jar .

Running XEP with the patched version, it has been reported to make no 
other impact: no difference in output, no performance loss. However, due 
to the nature of the bug and the impossibility to reproduce it in a 
reasonable time, I cannot guarantee that this issue will certainly never 
appear again.

Regards,
Michael Sulyaev
RenderX


msulyaev at lebuntu:~/jdk1.6.0_07.src/java/util$ diff -ubBr 
WeakHashMap.java.orig WeakHashMap.java
--- WeakHashMap.java.orig	2008-12-02 13:14:34.000000000 +0300
+++ WeakHashMap.java	2008-12-02 16:10:11.000000000 +0300
@@ -272,6 +272,7 @@
      private void expungeStaleEntries() {
  	Entry<K,V> e;
          while ( (e = (Entry<K,V>) queue.poll()) != null) {
+	    synchronized(queue) {
              int h = e.hash;
              int i = indexFor(h, table.length);

@@ -294,6 +295,7 @@
              }
          }
      }
+    }

      /**
       * Returns the table after first expunging stale entries.
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo at renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/terms-of-service.html



More information about the Xep-support mailing list