Bug 50036 - IdResolver Java API extension
Summary: IdResolver Java API extension
Alias: None
Product: Security - Now in JIRA
Classification: Unclassified
Component: Signature (show other bugs)
Version: Java 1.4.2
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: XML Security Developers Mailing List
Depends on:
Reported: 2010-10-01 08:18 UTC by Stefan Vladov
Modified: 2010-10-02 09:19 UTC (History)
0 users

Proposed patch. (1.47 KB, patch)
2010-10-01 08:18 UTC, Stefan Vladov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Vladov 2010-10-01 08:18:48 UTC
Created attachment 26110 [details]
Proposed patch.

I would like to suggest an extension to the xmlsec java API, namely to add a static method like unregisterDocument to org.apache.xml.security.utils.IdResolver to remove adocument from the static "docMap" WeakHashMap. Under long running high load test after some time we are experiencing a hangup with all the worker threads in the following state:

"HTTP Handler" Id=185 in RUNNABLE
 at java.util.WeakHashMap.get(WeakHashMap.java:355)
 at org.apache.xml.security.utils.IdResolver.registerElementById(Unknown Source)
 at org.apache.xml.security.signature.XMLSignature.setId(Unknown Source)
 at org.apache.ws.security.message.WSSecSignature.prepare(WSSecSignature.java:360)
 at org.apache.rampart.builder.BindingBuilder.getSignatureBuider(BindingBuilder.java:387)
 at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignature(AsymmetricBindingBuilder.java:716)
 at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(AsymmetricBindingBuilder.java:433)
 at org.apache.rampart.builder.AsymmetricBindingBuilder.build(AsymmetricBindingBuilder.java:95)
 at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:147)
 at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:79)
 at org.apache.axis2.engine.Phase.invoke(Phase.java:325)
 at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:429)

With manual cleanup of the weak has map this situation is avoided.
Comment 1 Stefan Vladov 2010-10-01 08:19:56 UTC
Sorry for the delay :(
Comment 2 coheigea 2010-10-02 09:18:55 UTC
Patch applied thanks (minus the annotations - the project is compatible with JDK 1.4):

Author: coheigea
Date: Sat Oct  2 13:17:40 2010
New Revision: 1003793

URL: http://svn.apache.org/viewvc?rev=1003793&view=rev
[Bug 50036] IdResolver Java API extension.
 - Patch applied. Also merged a fix to get a test working with JDK 1.4.