You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2012/03/05 07:30:17 UTC

svn commit: r1296944 - /tomcat/native/trunk/native/src/poll.c

Author: costin
Date: Mon Mar  5 06:30:17 2012
New Revision: 1296944

URL: http://svn.apache.org/viewvc?rev=1296944&view=rev
Log:
EINTR needs to be returned to java in order for Poll.interrupt() to work, it is already handled in AprEndpoint.
( there is no value of having an interrupt method if it is swallowed in native, quite hard to figure out why
it doesn't work...)


Modified:
    tomcat/native/trunk/native/src/poll.c

Modified: tomcat/native/trunk/native/src/poll.c
URL: http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/poll.c?rev=1296944&r1=1296943&r2=1296944&view=diff
==============================================================================
--- tomcat/native/trunk/native/src/poll.c (original)
+++ tomcat/native/trunk/native/src/poll.c Mon Mar  5 06:30:17 2012
@@ -358,7 +358,7 @@ TCN_IMPLEMENT_CALL(jint, Poll, poll)(TCN
 #ifdef TCN_DO_STATISTICS
                 p->sp_eintr++;
 #endif
-                continue;
+                /* Pass it to the caller - interrupt() was called */
             }
             TCN_ERROR_WRAP(rv);
 #ifdef TCN_DO_STATISTICS



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1296944 - /tomcat/native/trunk/native/src/poll.c

Posted by Mladen Turk <mt...@apache.org>.
On 03/06/2012 12:55 AM, Costin Manolache wrote:
> On Mon, Mar 5, 2012 at 1:39 PM, Costin Manolache<co...@gmail.com>  wrote:
>
>                          apr_pollset_drain_wakeup_pipe(pollset);
>                          rv = APR_EINTR;
>                  }
>
> (interrupt() calls poll_wakepup which writes to the wakeup_pipe ).
>

Ah, so its APR_EINTR, not EINTR.
That makes sense.


Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1296944 - /tomcat/native/trunk/native/src/poll.c

Posted by Costin Manolache <co...@gmail.com>.
On Mon, Mar 5, 2012 at 1:39 PM, Costin Manolache <co...@gmail.com> wrote:

>
>
> On Mon, Mar 5, 2012 at 4:45 AM, Mladen Turk <mt...@apache.org> wrote:
>
>> On 03/05/2012 07:30 AM, costin@apache.org wrote:
>>
>>> Author: costin
>>> Date: Mon Mar  5 06:30:17 2012
>>> New Revision: 1296944
>>>
>>> URL: http://svn.apache.org/viewvc?**rev=1296944&view=rev<http://svn.apache.org/viewvc?rev=1296944&view=rev>
>>> Log:
>>> EINTR needs to be returned to java in order for Poll.interrupt() to
>>> work, it is already handled in AprEndpoint.
>>>
>>
>> Not sure if that's correct.
>> EINTR is transient signal and doesn't mean that the actual event was
>> fired.
>> Any function that waits on some event should restart the operation if
>> EINTR
>> was signalled. See 'man poll'
>>
>> If interrupt doesn't work its something else to blame, not EINTR.
>>
>
> If interrupt() is called, EINTR is generated as result to poll - confirmed
> with printfs().
> Without this change - poll is not interrupted. I spent quite a bit of time
> debugging it.
>
> It is true EINTR is 'transient signal' and may be generated without an
> event fired - that's what
> interrupt is supposed to do after all, and it's possible other events
> cause it.
>
> I see no harm in returning this to the java stack - the AprEndpoint is
> expecting it along with timeup.
>
>
A better explanation:
apr/poll/unix/poll.c:

               /* Check if the polled descriptor is our
                 * wakeup pipe. In that case do not put it result set.
                 */
                if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
                    pollset->p->query_set[i].desc_type == APR_POLL_FILE &&
                    pollset->p->query_set[i].desc.f ==
pollset->wakeup_pipe[0]) {
                        apr_pollset_drain_wakeup_pipe(pollset);
                        rv = APR_EINTR;
                }

(interrupt() calls poll_wakepup which writes to the wakeup_pipe ).

Costin

Re: svn commit: r1296944 - /tomcat/native/trunk/native/src/poll.c

Posted by Costin Manolache <co...@gmail.com>.
On Mon, Mar 5, 2012 at 4:45 AM, Mladen Turk <mt...@apache.org> wrote:

> On 03/05/2012 07:30 AM, costin@apache.org wrote:
>
>> Author: costin
>> Date: Mon Mar  5 06:30:17 2012
>> New Revision: 1296944
>>
>> URL: http://svn.apache.org/viewvc?**rev=1296944&view=rev<http://svn.apache.org/viewvc?rev=1296944&view=rev>
>> Log:
>> EINTR needs to be returned to java in order for Poll.interrupt() to work,
>> it is already handled in AprEndpoint.
>>
>
> Not sure if that's correct.
> EINTR is transient signal and doesn't mean that the actual event was fired.
> Any function that waits on some event should restart the operation if EINTR
> was signalled. See 'man poll'
>
> If interrupt doesn't work its something else to blame, not EINTR.
>

If interrupt() is called, EINTR is generated as result to poll - confirmed
with printfs().
Without this change - poll is not interrupted. I spent quite a bit of time
debugging it.

It is true EINTR is 'transient signal' and may be generated without an
event fired - that's what
interrupt is supposed to do after all, and it's possible other events cause
it.

I see no harm in returning this to the java stack - the AprEndpoint is
expecting it along with timeup.

Costin

Re: svn commit: r1296944 - /tomcat/native/trunk/native/src/poll.c

Posted by Mladen Turk <mt...@apache.org>.
On 03/05/2012 07:30 AM, costin@apache.org wrote:
> Author: costin
> Date: Mon Mar  5 06:30:17 2012
> New Revision: 1296944
>
> URL: http://svn.apache.org/viewvc?rev=1296944&view=rev
> Log:
> EINTR needs to be returned to java in order for Poll.interrupt() to work, it is already handled in AprEndpoint.

Not sure if that's correct.
EINTR is transient signal and doesn't mean that the actual event was fired.
Any function that waits on some event should restart the operation if EINTR
was signalled. See 'man poll'

If interrupt doesn't work its something else to blame, not EINTR.


Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org