-
Notifications
You must be signed in to change notification settings - Fork 355
Safety net for infinite unproductive loop #527
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
Conversation
|
@farahaniali This work-around is hideous. I would prefer a proper fix to the problem instead. |
|
I agree with @ok2c , this type of change may be acceptable for local debugging but it doesn't belong in production. You may want to gather use case specific metrics and report them here. A reproducer would be best as usual. |
|
@ok2c and @garydgregory do not disagree with the fact that this is the simplest and arbitrary looking solution. Open to suggestion so I can incorporate any available mechanism to have a safety net in place. which has the following piece of code in place that would throw an SSLException right away if it finds out we got OK status but not progressed on the input encrypted buffer. |
|
@farahaniali IMO Hard-coding a 1 000-cycle guard is just another band-aid. |
|
@farahaniali If can propose a safe-guard that does not involve a magic number like 1000 I will happily review. |
@ok2c Just update the PR. |
|
@farahaniali All right. That makes more sense. I will merge the change-set to master but not to the stable 5.3.x branch for now. We will see how the TLS code behaves in the coming months. I will also tweak the exception message a bit. |
As a safety net for handling an infinite loop happening inside decrypt method (that has been reported here https://issues.apache.org/jira/browse/HTTPCORE-782), we propose a unproductive loop detection mechanism being added to it.
The mechanism counts the number of times the loop circles without consuming any data from the encrypted buffer while the unwrapping method reports a successful operation by returning OK status.
If we reach to 1000 unproductive loop, we throw an exception to escape the unproductive loop.
We are trying to have this feature inside production system, but have not seen the issue in weeks.