cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Wallez (JIRA)" <j...@apache.org>
Subject [jira] Closed: (COCOON-2208) Race condition in AbstractCachingProcessingPipeline causes threads to hang.
Date Sat, 07 Jun 2008 14:43:45 GMT

     [ https://issues.apache.org/jira/browse/COCOON-2208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sylvain Wallez closed COCOON-2208.
----------------------------------

    Resolution: Duplicate

Yes, it's the same as COCOON-1985. Sorry for the noise...

> Race condition in AbstractCachingProcessingPipeline causes threads to hang.
> ---------------------------------------------------------------------------
>
>                 Key: COCOON-2208
>                 URL: https://issues.apache.org/jira/browse/COCOON-2208
>             Project: Cocoon
>          Issue Type: Bug
>          Components: * Cocoon Core
>    Affects Versions: 2.1.11
>            Reporter: Sylvain Wallez
>            Priority: Blocker
>
> There's a race condition in AbstractCachingProcessingPipeline.waitForLock() : if "lock"
is not null, there is a possibility that the thread that created the lock releases it before
the current thread starts waiting on it (see below). When this happens, the thread waits forever
since no thread will ever call notify() on the lock.
> The very bad effect is that this progressively blocks the entire thread pool of the servlet
engine, which ends up rejecting new incoming connections.
> And BTW, calling containsKey() just before get() unneedingly doubles the number of lookups.
> {noformat}
>     protected boolean waitForLock(Object key) {
>     	if(transientStore != null) {
>     		Object lock = null;
>     		synchronized(transientStore) {
>     			String lockKey = PIPELOCK_PREFIX+key;
>     			if(transientStore.containsKey(lockKey)) {
>                 	// cache content is currently being generated, wait for other thread
>                 	lock = transientStore.get(lockKey);
>     			}
>     		}
> // START OF RACE CONDITION ZONE
>         	if(lock != null) {
>         		try {
>         			// become owner of monitor
>         			synchronized(lock) {
> // END OF RACE CONDITION ZONE
>         				lock.wait();
>         			}
>         		} catch (InterruptedException e) {
>         			if(getLogger().isDebugEnabled()) {
>         				getLogger().debug("Got interrupted waiting for other pipeline to finish processing,
retrying...",e);
>         			}
>         			return false;
> 				}
>         		if(getLogger().isDebugEnabled()) {
>     				getLogger().debug("Other pipeline finished processing, retrying to get cached
response.");
>     			}
>         		return false;
>         	}
>     	}
>     	return true;
>     }
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message