On 22.09.2013 13:17, Rainer Jung wrote:
> I debugged around my occasional failures for TestCoyoteAdapter when
> using APR.
>
> Error is:
>
> SEVERE [http-apr-127.0.0.1-auto-13-Poller]
> org.apache.tomcat.util.net.AprEndpoint$Poller.run Poller failed with
> error [81] : [File descriptor in bad state]
...
> Not sure whether the problem is more in the concurrent poll plus remove,
> or the following code in poll.c:
>
> TCN_IMPLEMENT_CALL(jint, Poll, remove)(TCN_STDARGS, jlong pollset,
> jlong socket)
> {
> apr_pollfd_t fd;
> apr_status_t rv;
> tcn_pollset_t *p = J2P(pollset, tcn_pollset_t *);
> tcn_socket_t *s = J2P(socket, tcn_socket_t *);
>
> UNREFERENCED_STDARGS;
> TCN_ASSERT(socket != 0);
>
> if (s->pe == NULL) {
> /* Already removed */
> return APR_SUCCESS;
> }
>
> Here we return APR_SUCCESS and the code calling Poll.remove in
> AprEndpoint always does:
>
> rv = Poll.remove(pollers[i], socket);
> if (rv != Status.APR_NOTFOUND) {
> pollerSpace[i]++;
> connectionCount--;
> break;
> }
>
> So the pollerSpace and connectionCount numbers are (in/de)cremented.
The following patch seems to fix it for me, at least 150 test runs for
TestCoyoteAdapter were successful:
Index: ../native/branches/1.1.x/native/src/poll.c
===================================================================
--- ../native/branches/1.1.x/native/src/poll.c (revision 1525348)
+++ ../native/branches/1.1.x/native/src/poll.c (working copy)
@@ -259,7 +259,7 @@
if (s->pe == NULL) {
/* Already removed */
- return APR_SUCCESS;
+ return APR_NOTFOUND;
}
fd.desc_type = APR_POLL_SOCKET;
fd.desc.s = s->sock;
I'll let the full test suite for APR run a couple of times as a more
thorough check. I hope the change doesn't break the correctnes of the
connection counting which is only done after succesful return of remove.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]