Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix defect in DoSFilter where semaphore acquires my be leaked #54

Closed
wants to merge 1 commit into from

Conversation

jentfoo
Copy link
Contributor

@jentfoo jentfoo commented Oct 1, 2015

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.

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.
@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 1, 2015

I am not sure where it is getting my fullcontact email from. I committed with the same email email I registered on the foundation and signed the agreement with.

@joakime
Copy link
Member

joakime commented Oct 1, 2015

Your email address is likely coming from your github credentials.

@joakime
Copy link
Member

joakime commented Oct 1, 2015

Looking at the raw commit for this PR, it shows your gmail address.

@joakime
Copy link
Member

joakime commented Oct 1, 2015

Something is wrong with the CLA check webhook.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=469140#c7

@eclipsewebmaster
Copy link

I've posted a response on the bug.

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 1, 2015

@eclipsewebmaster I have both emails associated with my github account. The jentfoo email is my primary github email, and the fullcontact one is a secondary one, associated only to the fullcontact organization in github.

In any case, both emails are associated to github.

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 1, 2015

Sorry, I just checked, another email is primary (which is private). But the jentfoo email is still associated with my github like I originally indicated.

@gregw
Copy link
Contributor

gregw commented Oct 1, 2015

@jentfoo This change is good..... however I would say that if AsyncContext.dispatch() is throwing RejectedExecutionException then your service is going to have other problems and failed requests.

The idea of the DoS filter is to limit resource commitments to what the server has on offer, so in this case either your threadpool is too small, your threadpool Q is too finite, there are too many other requests not going via the DoSFilter or the DoSFilter limit is set too high.

So it would be good to know if you can configure to avoid this exception (but happy to have the finally to handle it if it does happen).

@jentfoo
Copy link
Contributor Author

jentfoo commented Oct 1, 2015

@gregw thanks for the response. I am aware of this. This is an internal service, and we have already made the decision that we would rather fail fast, rather than add latency to these requests (and thus why we have a very limited queue to the pool).

You also hit the nail on the head when you said "there are too many other requests not going via the DoSFilter". We are using this dos filter to actually protect a specific database from becoming overburdened. And are actually only filtering a few specific user agents (aka other internal services)...most requests are ignored by this filter.

I am aware that if the pool queue was large enough, in theory this may not be happening. But even in that condition this still would be theoretically possible given enough load/queued requests.

@gregw
Copy link
Contributor

gregw commented Oct 1, 2015

@jentfoo Mike thanks for the extra information. Note that historically jetty was a bit fragile to a limited threadpool and rejected execution failures, however we believe that with 9.3.x and our Eat-What-You-Kill scheduling, then we are more robust in the advent of such failures as Dispatches are only used to recruit more helpers and that even if they fail a single thread could actually perform all the tasks serially and then go back to selecting for more.

While testing this limited threadpool scenario, I'd be keen to know of any other issues that you may detect.

So we'll merge this one once the ip-validation is sorted. @joakime are you on that case?

@joakime
Copy link
Member

joakime commented Oct 2, 2015

on the ip-validation front ...

Updated message from Denis Roy...

This bug is about looking up the GitHUB ID (jentfoo in this case). I can't find any Eclipse account that has a GitHUB ID of jentfoo.

So we're extracting the email address from the GitHub account, which does not match their Eclipse account.

Anyone can write anything in the Commit message, whereas the GitHub credentials have at least been verified.

In this case, they can log into https://dev.eclipse.org/site_login/ and configure their account to link to their GitHUB ID. There would then be no confusion.

@jentfoo I think you'll want to correct that for future commits.

@gregw I would expect we are clear, as his @gmail.com address, which is on the details of this PR, is validating on the official validation URL at https://projects.eclipse.org/user/cla/validate

@gregw
Copy link
Contributor

gregw commented Oct 12, 2015

merged to 9.3.x - thanks!

@gregw gregw closed this Oct 12, 2015
gregw pushed a commit that referenced this pull request Oct 12, 2015
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.

#54

Signed-off-By: jentfoo@gmail.com
gregw pushed a commit that referenced this pull request Oct 12, 2015
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.

#54

Signed-off-By: jentfoo@gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants