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 2014/06/19 12:44:27 UTC

[Bug 56645] New: socket callback with timeout callback causes infinite loop

https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

            Bug ID: 56645
           Summary: socket callback with timeout callback causes infinite
                    loop
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: mpm_event
          Assignee: bugs@httpd.apache.org
          Reporter: takashi.asfbugzilla@tks.st

Even after fix bug 56642, mod_proxy_wstunnel with ProxyWebsocketAsync On and
ProxyWebsocketIdleTimeout doesn't work well.

I sent and receive small data many times, and sometimes went infinite loop.

I got core and backtrace, and I saw one loop was inside of apr_skiplist_insert
(event.c line 1464), and another is on while loop (event.c line 1767).

I looked at event.c and found all timer_skiplist seemed to be well protected
with g_timer_skiplist_mtx, so I don't have any idea why the infinity loop
occurs.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #5 from Takashi Sato <ta...@tks.st> ---
(In reply to Takashi Sato from comment #2)
> (In reply to Eric Covener from comment #1)
> > I notice there is no checking of the return code for lock/unlock of those
> > mutexes. They could be failing
> 
> OK, I try to put trace logs to log whether lock/unlock success or not.

I tried. lock/unlock succeed...

Then, I tried to migrate apr_skiplist to apr_array, then works fine (of cource
performance is bad and may have memory leaks)!
It seems apr_skiplist has some bug.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #1 from Eric Covener <co...@gmail.com> ---
I notice there is no checking of the return code for lock/unlock of those
mutexes. They could be failing

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #4 from Yann Ylavic <yl...@gmail.com> ---
(In reply to Yann Ylavic from comment #3)
> There seem to be a race between the cancellation check and set.

Hmm, these are in the same thread, sorry for the noise.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #7 from Takashi Sato <ta...@tks.st> ---
Created attachment 31733
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31733&action=edit
patch for debug (event MPM using apr_array for timer list)

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

Takashi Sato <ta...@tks.st> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |56654

--- Comment #8 from Takashi Sato <ta...@tks.st> ---
I observed apr_skiplist corruption, so I have annalyzed apr_skiplist, and found
the bug 56654.
With 56654 fixed APR, I don't see any infinite loop.

I don't think Yann's patch.
baton->cancel_event->canceled does not affect any for timer_skiplist.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #6 from Eric Covener <co...@gmail.com> ---
(In reply to Takashi Sato from comment #5)
> (In reply to Takashi Sato from comment #2)
> > (In reply to Eric Covener from comment #1)
> > > I notice there is no checking of the return code for lock/unlock of those
> > > mutexes. They could be failing
> > 
> > OK, I try to put trace logs to log whether lock/unlock success or not.
> 
> I tried. lock/unlock succeed...
> 
> Then, I tried to migrate apr_skiplist to apr_array, then works fine (of
> cource performance is bad and may have memory leaks)!
> It seems apr_skiplist has some bug.

You might try Yanns patch. I don't know anything about the skiplist impl, but I
don't know what might get moved while other threads add/remove unrelated
entries.  In that case, his lock would unfortunately be required.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #2 from Takashi Sato <ta...@tks.st> ---
(In reply to Eric Covener from comment #1)
> I notice there is no checking of the return code for lock/unlock of those
> mutexes. They could be failing

OK, I try to put trace logs to log whether lock/unlock success or not.

-- 
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 56645] socket callback with timeout callback causes infinite loop

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56645

--- Comment #3 from Yann Ylavic <yl...@gmail.com> ---
Maybe the following path can help?

Index: server/mpm/event/event.c
===================================================================
--- server/mpm/event/event.c    (revision 1603193)
+++ server/mpm/event/event.c    (working copy)
@@ -1975,7 +1975,9 @@ static void * APR_THREAD_FUNC listener_thread(apr_
                 int i = 0;
                 socket_callback_baton_t *baton = (socket_callback_baton_t *)
pt->baton;
                 if (baton->cancel_event) {
+                    apr_thread_mutex_lock(g_timer_skiplist_mtx);
                     baton->cancel_event->canceled = 1;
+                    apr_thread_mutex_unlock(g_timer_skiplist_mtx);
                 }

                 /* We only signal once per N sockets with this baton */
--

There seem to be a race between the cancellation check and set.

-- 
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