Re: Bug in ContinuationManagerImpl

2008-09-04 Thread Leszek Gawron

Joerg Heinicke wrote:

On 03.09.2008 21:25, Gabriel Gruber wrote:

just discovered an exception inside our freshly migrated cocoon 2.2 
migration, thrown by the ContinuationManagerImpl:


Exception in thread Timer-0 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl.invalidateContinuations( 


ContinuationsManagerImpl.java:390)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound( 


ContinuationsManagerImpl.java:548)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(

AbstractSessionManager.java:1125)



Is this a new bug, or am I doing something wrong?


It's a new bug I introduced with [1]. Reviewing the changes I did I 
found that I optimized some code. :-) It's around line 390 [2]. I'll 
have a look on how to fix it. Sorry for the inconveniences.


Joerg

[1] http://svn.apache.org/viewvc?view=revrevision=643752
[2] 
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java?r1=643716r2=643752diff_format=h 


You were not the only one trying to fix the ugly code, I did the same 
something about 2 years ago :)


lg
--
Leszek Gawron


Re: Bug in ContinuationManagerImpl

2008-09-04 Thread Joerg Heinicke

On 03.09.2008 23:37, Joerg Heinicke wrote:

just discovered an exception inside our freshly migrated cocoon 2.2 
migration, thrown by the ContinuationManagerImpl:


Exception in thread Timer-0 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl.invalidateContinuations( 


ContinuationsManagerImpl.java:390)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound( 


ContinuationsManagerImpl.java:548)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(

AbstractSessionManager.java:1125)



Is this a new bug, or am I doing something wrong?


It's a new bug I introduced with [1]. Reviewing the changes I did I 
found that I optimized some code. :-) It's around line 390 [2]. I'll 
have a look on how to fix it. Sorry for the inconveniences.


Hey Gabriel,

I committed a fix. Can you please retry and report back?

Thanks,

Joerg


Bug in ContinuationManagerImpl

2008-09-03 Thread Gabriel Gruber
Hi Folks,

just discovered an exception inside our freshly migrated cocoon 2.2 
migration, thrown by the ContinuationManagerImpl:

Exception in thread Timer-0 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl.invalidateContinuations(
ContinuationsManagerImpl.java:390)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound(
ContinuationsManagerImpl.java:548)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(
AbstractSessionManager.java:1125)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.doInvalidate(
AbstractSessionManager.java:965)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.timeout(
AbstractSessionManager.java:924)
at org.mortbay.jetty.servlet.HashSessionManager.scavenge(
HashSessionManager.java:221)
at org.mortbay.jetty.servlet.HashSessionManager.access$000(
HashSessionManager.java:44)
at org.mortbay.jetty.servlet.HashSessionManager$1.run(
HashSessionManager.java:165)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)

Is this a new bug, or am I doing something wrong?

I am using trunk version of Flowscript (1.1.0-SNAPSHOT)

cheers,

Gabriel

__
Mag. Gabriel Gruber
Senior Consultant
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Workflow EDV GmbH, Dannebergplatz 6/23, A-1030 Wien
http://www.workflow.at

Re: Bug in ContinuationManagerImpl

2008-09-03 Thread Joerg Heinicke

On 03.09.2008 21:25, Gabriel Gruber wrote:

just discovered an exception inside our freshly migrated cocoon 2.2 
migration, thrown by the ContinuationManagerImpl:


Exception in thread Timer-0 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl.invalidateContinuations(

ContinuationsManagerImpl.java:390)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound(

ContinuationsManagerImpl.java:548)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(

AbstractSessionManager.java:1125)



Is this a new bug, or am I doing something wrong?


It's a new bug I introduced with [1]. Reviewing the changes I did I 
found that I optimized some code. :-) It's around line 390 [2]. I'll 
have a look on how to fix it. Sorry for the inconveniences.


Joerg

[1] http://svn.apache.org/viewvc?view=revrevision=643752
[2] 
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java?r1=643716r2=643752diff_format=h


Re: Bug in ContinuationManagerImpl

2008-09-03 Thread Joerg Heinicke

On 03.09.2008 23:37, Joerg Heinicke wrote:


Exception in thread Timer-0 java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$ValueIterator.next(Unknown Source)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl.invalidateContinuations( 
ContinuationsManagerImpl.java:390)
at 
org.apache.cocoon.components.flow.ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound( 
ContinuationsManagerImpl.java:548)
at 
org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(

AbstractSessionManager.java:1125)


It's a new bug I introduced with [1]. Reviewing the changes I did I 
found that I optimized some code. :-) It's around line 390 [2]. I'll 
have a look on how to fix it. Sorry for the inconveniences.


Two different proposals:
1. Reintroducing the original workaround using 
continuationsHolder.holder.values().toArray() in 
invalidateContinuations(..).


2. Adding iter.remove() directly after iter.next() in line 390. The 
later problematic call to remove the continuation from the map would 
just not do anything.


WDYT?

Joerg


[1] http://svn.apache.org/viewvc?view=revrevision=643752
[2] 
http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/components/flow/ContinuationsManagerImpl.java?r1=643716r2=643752diff_format=h 


Re: Bug in ContinuationManagerImpl

2008-09-03 Thread Gabriel Gruber
  Exception in thread Timer-0 
java.util.ConcurrentModificationException
  at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
  at java.util.HashMap$ValueIterator.next(Unknown Source)
  at 
  org.apache.cocoon.components.flow.ContinuationsManagerImpl.
 invalidateContinuations( 
  ContinuationsManagerImpl.java:390)
  at 
  org.apache.cocoon.components.flow.
 ContinuationsManagerImpl$WebContinuationsHolder.valueUnbound( 
  ContinuationsManagerImpl.java:548)
  at 
  org.mortbay.jetty.servlet.AbstractSessionManager$Session.unbindValue(
  AbstractSessionManager.java:1125)
  
  It's a new bug I introduced with [1]. Reviewing the changes I did I 
  found that I optimized some code. :-) It's around line 390 [2]. I'll 

  have a look on how to fix it. Sorry for the inconveniences.
 
 Two different proposals:
 1. Reintroducing the original workaround using 
 continuationsHolder.holder.values().toArray() in 
 invalidateContinuations(..).
 
 2. Adding iter.remove() directly after iter.next() in line 390. The 
 later problematic call to remove the continuation from the map would 
 just not do anything.
 
 WDYT?

+1 for first proposal) this seems much cleaner to me, than calling 
iter.next() and afterwards iter.remove()

cheers,gabriel