Project

General

Profile

[Solved] How to debug "ENDLESS LOOP" errors?

Added by blupp almost 6 years ago

Hello,
I have a lot of these errors in my error.log:
"ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat"

How can I find out, what rewrite rule or at least which request caused this error with minimal debug options, so that the error file is not growing too much?

Thanks ...


Replies (4)

RE: How to debug "ENDLESS LOOP" errors? - Added by gstrauss almost 6 years ago

Without enabling additional debug logging, you need to correlate timestamps between your accesslog and errorlog, and then you can re-run test requests yourself to find which specific request(s) triggers errors.

RE: How to debug "ENDLESS LOOP" errors? - Added by gstrauss almost 6 years ago

If you build your own lighttpd from source, you could also apply this patch:

--- a/src/mod_rewrite.c
+++ b/src/mod_rewrite.c
@@ -353,8 +353,9 @@ static handler_t process_rewrite_rules(server *srv, connection *con, plugin_data
                hctx = con->plugin_ctx[p->id];

                if (hctx->loops++ > 100) {
-                       log_error_write(srv, __FILE__, __LINE__,  "s",
-                                       "ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat");
+                       data_config *dc = p->conf.context;
+                       log_error_write(srv, __FILE__, __LINE__,  "SbbSBS",
+                                       "ENDLESS LOOP IN rewrite-rule DETECTED ... aborting request, perhaps you want to use url.rewrite-once instead of url.rewrite-repeat ($", dc->comp_key, dc->op, "\"", dc->string, "\")");

                        return HANDLER_ERROR;
                }

RE: How to debug "ENDLESS LOOP" errors? - Added by blupp almost 6 years ago

gstrauss wrote:

Without enabling additional debug logging, you need to correlate timestamps between your accesslog and errorlog, and then you can re-run test requests yourself to find which specific request(s) triggers errors.

thanks!

Also recompiled lighttpd with your patch.

RE: How to debug "ENDLESS LOOP" errors? - Added by blupp almost 6 years ago

Could identify the cause, thanks again. Maybe that patch should be part of the standard code.

    (1-4/4)