You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2012/03/21 20:32:41 UTC
DO NOT REPLY [Bug 52964] New: system error because of negative
rate-limit
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Bug #: 52964
Summary: system error because of negative rate-limit
Product: Apache httpd-2
Version: 2.4.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: mod_ratelimit
AssignedTo: bugs@httpd.apache.org
ReportedBy: tixu@cs.ucsd.edu
Classification: Unclassified
Created attachment 28492
--> https://issues.apache.org/bugzilla/attachment.cgi?id=28492
patch for mod_ratelimit
To replay, use the following setting in httpd.conf:
<Location /downloads>
SetOutputFilter RATE_LIMIT
SetEnv rate-limit -400
</Location>
Start the httpd server; use your browser to access http://ipaddress/downloads/
Then, the access will be stuck and the server will print out the following
message in error log:
[Wed Mar 21 10:58:33.664383 2012] [ratelimit:error] [pid 2951:tid
140736908777216] [client 132.239.17.127:46106] AH01456: rl: partition failed.
The message is really bad for users. Who knows what is the "rl" and what is the
"partition"?
Take a look at the code and find the root cause:
------------------------
//modules/filters/mod_ratelimit.c
const char *rl = NULL;
rl = apr_table_get(f->r->subprocess_env, "rate-limit");
if (rl == NULL) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
/* first run, init stuff */
ctx = apr_palloc(f->r->pool, sizeof(rl_ctx_t));
f->ctx = ctx;
ctx->speed = 0;
ctx->state = RATE_LIMIT;
/* rl is in kilo bytes / second */
ctx->speed = atoi(rl) * 1024;
if (ctx->speed == 0) {
/* remove ourselves */
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
/* calculate how many bytes / interval we want to send */
/* speed is bytes / second, so, how many (speed / 1000 % interval) */
ctx->chunk_size = (ctx->speed / (1000 / RATE_INTERVAL_MS));
......
rv = apr_brigade_partition(bb, ctx->chunk_size, &stop_point);
if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) {
ctx->state = RATE_ERROR;
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, f->r, APLOGNO(01456)
"rl: partition failed.");
break;
}
------------------------
Here is the thing: after get the ctx->speed, the code only checks whether it's
0 or not. If it's 0, then the cleaning job will be done. But a negative value
will go much further and cause the error point.
A simple fix will be change the checking from "if (ctx->speed == 0) {" to "if
(ctx->speed <= 0) {" as the attachment.
Thanks!
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
DO NOT REPLY [Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Tianyin Xu <ti...@cs.ucsd.edu> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tixu@cs.ucsd.edu
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Christophe JAILLET <ch...@wanadoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |PatchAvailable
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Christophe JAILLET <ch...@wanadoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #28492|0 |1
is patch| |
Attachment #28492|application/octet-stream |text/plain
mime type| |
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
--- Comment #1 from Christophe JAILLET <ch...@wanadoo.fr> ---
Thanks for the report.
Fixed in trunk in r1439623
I applied a slightly different version of the patch.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Graham Leggett <mi...@sharp.fm> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Graham Leggett <mi...@sharp.fm> ---
Backported to v2.4.5 in r1455219.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org
[Bug 52964] system error because of negative rate-limit
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52964
Christophe JAILLET <ch...@wanadoo.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |FixedInTrunk
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org