Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Jensen2015-10-01 11:32:19 -0400
committerGreg Wilkins2015-10-12 17:48:45 -0400
commit407ca46d94b566822c219fe518b487f16d0becc4 (patch)
treeef68bba13fa1b508d3c28e8042c298bba4b92c8b /jetty-servlets
parent8f732a423d3cb3827fc0da71bb5de4f652414ff7 (diff)
downloadorg.eclipse.jetty.project-407ca46d94b566822c219fe518b487f16d0becc4.tar.gz
org.eclipse.jetty.project-407ca46d94b566822c219fe518b487f16d0becc4.tar.xz
org.eclipse.jetty.project-407ca46d94b566822c219fe518b487f16d0becc4.zip
Fix defect in DoSFilter where semaphore acquires my be leaked
When trying to release the semaphore in the finally block, 'asyncContext.dispatch()' may throw a "RejectedExecutionException". If this occurs, then the semaphore will never be released. Ultimately the condition will result in all threads blocking to acquire the semaphore as the DoSFilter is continue to be used. https://github.com/eclipse/jetty.project/pull/54 Signed-off-By: jentfoo@gmail.com
Diffstat (limited to 'jetty-servlets')
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
index fad67d2721..8a13382865 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/DoSFilter.java
@@ -427,25 +427,31 @@ public class DoSFilter implements Filter
{
if (accepted)
{
- // Wake up the next highest priority request.
- for (int p = _queues.length - 1; p >= 0; --p)
+ try
{
- AsyncContext asyncContext = _queues[p].poll();
- if (asyncContext != null)
+ // Wake up the next highest priority request.
+ for (int p = _queues.length - 1; p >= 0; --p)
{
- ServletRequest candidate = asyncContext.getRequest();
- Boolean suspended = (Boolean)candidate.getAttribute(_suspended);
- if (suspended == Boolean.TRUE)
+ AsyncContext asyncContext = _queues[p].poll();
+ if (asyncContext != null)
{
- if (LOG.isDebugEnabled())
- LOG.debug("Resuming {}", request);
- candidate.setAttribute(_resumed, Boolean.TRUE);
- asyncContext.dispatch();
- break;
+ ServletRequest candidate = asyncContext.getRequest();
+ Boolean suspended = (Boolean)candidate.getAttribute(_suspended);
+ if (suspended == Boolean.TRUE)
+ {
+ if (LOG.isDebugEnabled())
+ LOG.debug("Resuming {}", request);
+ candidate.setAttribute(_resumed, Boolean.TRUE);
+ asyncContext.dispatch();
+ break;
+ }
}
}
}
- _passes.release();
+ finally
+ {
+ _passes.release();
+ }
}
}
}

Back to the top