[jira] [Issue Comment Edited] (DIGESTER-163) ConcurrentModificationException creating a new Digester via loaderInstance.newDigester()

2012-03-16 Thread Thomas Neidhart (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/DIGESTER-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13231548#comment-13231548
 ] 

Thomas Neidhart edited comment on DIGESTER-163 at 3/16/12 7:34 PM:
---

I have no idea about the digester, but I looked at this issue out of curiosity 
(and I like to debug concurrency problems ;-).

The problems is in the DigesterLoader#addRules method:

 * createRuleSet clears the underlying rule binder
 * addRuleInstance iterates over the same rule binder

If you make this method synchronized, you will not get an exception anymore.

What I do not know, if the createRuleSet is implemented correctly. I would 
expect that the initialization of the rules binder happens when the 
DigesterLoader is created, not when a new digester is requested, but this is 
may be due to lazy loading?

  was (Author: tn):
I have no idea about the digester, but I looked at this issue out of 
curiosity (and I like to debug concurrency problems ;-).

The problems is in the DigesterLoader#addRules method:

 * createRuleSet clears the underlying rule binder
 * addRuleInstance iterates of the same rule binder

If you make this method synchronized, you will not get an exception anymore.

What I do not know, if the createRuleSet is implemented correctly. I would 
expect that the initialization of the rules binder happens when the 
DigesterLoader is created, not when a new digester is requested, but this is 
may be due to lazy loading?
  
> ConcurrentModificationException creating a new Digester via 
> loaderInstance.newDigester()
> 
>
> Key: DIGESTER-163
> URL: https://issues.apache.org/jira/browse/DIGESTER-163
> Project: Commons Digester
>  Issue Type: Bug
>Affects Versions: 3.2
> Environment: Linux, JDK 6
>Reporter: Torsten Krah
> Attachments: 163-2.patch, 163.patch, Digester163TestCase.java, 
> cli-mvn-test-withfix.txt, stack-afterfix.txt, stack-mvn.txt, stack-next.txt, 
> stack-next2.txt
>
>
> I am gettig a ConcurrentModificationException when trying to create new 
> Digester instance from a configured loader:
> Trace is:
> {code}
> java.util.ConcurrentModificationException: null
>   at 
> java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:761) 
> ~[na:1.6.0_27]
>   at java.util.LinkedList$ListItr.next(LinkedList.java:696) ~[na:1.6.0_27]
>   at 
> org.apache.commons.digester3.binder.FromBinderRuleSet.addRuleInstances(FromBinderRuleSet.java:130)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.addRules(DigesterLoader.java:581)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:568)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:516)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:475)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:462)
>  ~[commons-digester3-3.2.jar:3.2]
> {code}
> The binder documentation (employee servlet) and the mailing list did confirm 
> to me, that the loader should be safe to be shared, so this should not happen.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Issue Comment Edited] (DIGESTER-163) ConcurrentModificationException creating a new Digester via loaderInstance.newDigester()

2012-03-15 Thread Simone Tripodi (Issue Comment Edited) (JIRA)

[ 
https://issues.apache.org/jira/browse/DIGESTER-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230070#comment-13230070
 ] 

Simone Tripodi edited comment on DIGESTER-163 at 3/15/12 11:07 AM:
---

I imported a simplified version of your testcase in the Digester codebase, see 
[r1300873|https://svn.apache.org/viewvc?view=revision&revision=1300873]; 
unfortunately I am not able to reproduce the issue :(

IIUC - apologize if I am wrong - the problem could be in your wrappers that 
allows concurrency in the loader creation - using the {{ConcurrentHashMap}} you 
keep the data structure thread-safe but it doesn't shield from races and 
concurrent accesses to the Loader creation...

Can you please check it? TIA!!!

  was (Author: simone.tripodi):
I imported a simplified version of your testcase in the Digester codebase, 
see [r1300873|https://svn.apache.org/viewvc?view=revision&revision=1300873]; 
unfortunately I am not able to reproduce the issue :(

IIUC - apologize if I am wrong - the problem could be in your wrappers that 
allows concurrency in the loader creation - using the {{{ConcurrentHashMap}} 
you keep the data structure thread-safe but it doesn't shield from races and 
concurrent accesses to the Loader creation...

Can you please check it? TIA!!!
  
> ConcurrentModificationException creating a new Digester via 
> loaderInstance.newDigester()
> 
>
> Key: DIGESTER-163
> URL: https://issues.apache.org/jira/browse/DIGESTER-163
> Project: Commons Digester
>  Issue Type: Bug
>Affects Versions: 3.2
> Environment: Linux, JDK 6
>Reporter: Torsten Krah
>
> I am gettig a ConcurrentModificationException when trying to create new 
> Digester instance from a configured loader:
> Trace is:
> {code}
> java.util.ConcurrentModificationException: null
>   at 
> java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:761) 
> ~[na:1.6.0_27]
>   at java.util.LinkedList$ListItr.next(LinkedList.java:696) ~[na:1.6.0_27]
>   at 
> org.apache.commons.digester3.binder.FromBinderRuleSet.addRuleInstances(FromBinderRuleSet.java:130)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.addRules(DigesterLoader.java:581)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:568)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:516)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:475)
>  ~[commons-digester3-3.2.jar:3.2]
>   at 
> org.apache.commons.digester3.binder.DigesterLoader.newDigester(DigesterLoader.java:462)
>  ~[commons-digester3-3.2.jar:3.2]
> {code}
> The binder documentation (employee servlet) and the mailing list did confirm 
> to me, that the loader should be safe to be shared, so this should not happen.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira