Bug 51503 - Additional error checking required for connector port attribute (e.g. for port="")
Additional error checking required for connector port attribute (e.g. for por...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Connectors
trunk
PC Windows Server 2003
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2011-07-13 12:40 UTC by Etienne Massip
Modified: 2016-01-07 06:17 UTC (History)
0 users



Attachments
catalina.2016-01-07.log (5.54 KB, text/plain)
2016-01-07 05:44 UTC, Konstantin Kolinko
Details
catalina.2016-01-07.log (2) (8.43 KB, text/plain)
2016-01-07 06:17 UTC, Konstantin Kolinko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Etienne Massip 2011-07-13 12:40:11 UTC
With 7.0.18 packaged as a candidate for release and finally unreleased, when I stop the Tomcat service (only 1 war deployed), the service takes a lot of time to stop and finally was killed by system.

Having a look into the stderr log, I see it paused right after the folowing line :

INFO: Stopping ProtocolHandler [http-apr-0]

Then went into a slow loop and fill the log with these lines :

13 juil. 2011 14:30:30 org.apache.tomcat.util.net.AprEndpoint stopInternal
ATTENTION: Acceptor thread [http-apr-0-Acceptor-0] failed to unlock. Forcing hard socket shutdown.
13 juil. 2011 14:30:31 org.apache.tomcat.util.net.AprEndpoint stopInternal
ATTENTION: Acceptor thread [http-apr-0-Acceptor-0] failed to unlock. Forcing hard socket shutdown.
13 juil. 2011 14:30:32 org.apache.tomcat.util.net.AprEndpoint stopInternal
ATTENTION: Acceptor thread [http-apr-0-Acceptor-0] failed to unlock. Forcing hard socket shutdown.
etc. (about 30 times before it was killed)

I think there was no such issue with 7.0.16.
Comment 1 Mark Thomas 2011-07-13 12:43:23 UTC
This has already been fixed in trunk and will be included in 7.0.19 onwards.
Comment 2 Etienne Massip 2011-07-18 08:50:27 UTC
I got the same issue with 7.0.19; please also note that my HTTP connector is disabled in server.xml.
Comment 3 Mark Thomas 2011-07-18 09:26:12 UTC
This report makes no sense. If the http connector is disabled then there won't be any http acceptor threads.
Comment 4 Etienne Massip 2011-07-18 09:33:06 UTC
Got it : It happens when I remove the 8080 HTTP port value at installation time.

I thought that the installer then would comment the HTTP connector part in the server.xml, but actually, it just wrote port="".

I guess you should consider adding a check that the port number value should not be empty to prevent the user to be misled as I was.
Comment 5 Etienne Massip 2011-07-18 09:36:00 UTC
BTW, there is no error logged at server startup, is the port="" syntax legal ?
Comment 6 Mark Thomas 2011-07-18 15:15:32 UTC
OK, that makes a lot more sense. Looks like some
Comment 7 Mark Thomas 2011-07-18 15:15:53 UTC
... additional checks are required.
Comment 8 Mark Thomas 2011-07-18 16:19:23 UTC
The additional validation has been added to 7.0.x and will be included in 7.0.20 onwards.
Comment 9 Konstantin Kolinko 2016-01-07 05:44:48 UTC
Created attachment 33416 [details]
catalina.2016-01-07.log

I reviewed the fix (r1147949) with the question of backporting it to current Tomcat 6, while working on bug 52028.

The current behaviour of Tomcat 6:

1). The installer part of the fix r1147949 (tomcat.nsi) has already been backported to Tomcat 6.

I tested installer for 6.0.44. It has this feature and works well.

2). The message "Acceptor thread .. failed to unlock." from Comment 0 is observed when running with APR connector.

I tested the current 6.0.x/trunk (6.0.45-dev)

With APR connectors there is a delay of 10 seconds for each connector
during Tomcat shutdown.
The message is printed only once, not 30 times.

> 07.01.2016 8:04:54 org.apache.tomcat.util.net.AprEndpoint stop
> WARNING: Acceptor thread [http-0-Acceptor-0] failed to unlock. Forcing hard socket shutdown.

There is no message when running with BIO connectors,
and there are no delays during shutdown.

Thus only APR connectors are affected.

I will attach the logs, for a reference.


My conclusion:

1). It is worth fixing AprEndpoint so that it does not try connecting to a wrong port number and does not print that message.

I think the AprEndpoint issue will be addressed under bug 52028 / r1208115.

2). It is worth protecting from missing port number, but it is not worth rejecting the port number of 0 like r1147949 does.

The value of 0 may be a valid use case now, and it will be a valid use case once bug 52028 is implemented.

Tomcat 7 (since r1207695) uses the default of -1.
Comment 10 Konstantin Kolinko 2016-01-07 06:14:12 UTC
Implemented in Tomcat 6 by r1723466 and will be in 6.0.45 onwards.
Comment 11 Konstantin Kolinko 2016-01-07 06:17:33 UTC
Created attachment 33417 [details]
catalina.2016-01-07.log (2)

The log from testing the implemented feature. For a reference.

Tomcat 6 @r1723466