Bug 49030 - Processing of Tomcat Connector configuration can leave some connectors uninitialized
Summary: Processing of Tomcat Connector configuration can leave some connectors uninit...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.26
Hardware: PC Windows Server 2003
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
: 46461 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-03-31 12:34 UTC by Artur Linhart
Modified: 2011-04-12 18:12 UTC (History)
1 user (show)



Attachments
2010-06-24_tc6_bug49030.patch (7.03 KB, patch)
2010-06-23 21:47 UTC, Konstantin Kolinko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Artur Linhart 2010-03-31 12:34:56 UTC
If the Server part of the Tomcat 6 configuration is beeing processed and there are more connectory defined, it seems to be the fact the exceptions during the connector initialization are not catched properly, so if there comes some exception by the initialization of one connector (for example to try to initialize the new connector for the same port like had the already initialized connector), then no other connectors are processed and created (no one listening port is allocated) even if such other connectors are defined properly. It leads to the situation the connectory are then initialized differently if the order of the connectors changes. It can be very confusing if searching some error in the definitions. Together with the fact, the default server.xml contains at least in some cases the invalid connector definition it leads to serious confusion it searching the configuration problem...
Comment 1 Artur Linhart 2010-03-31 12:40:56 UTC
It is then the problem especially in the connection with the bug 49031
Comment 2 Mark Thomas 2010-03-31 13:07:37 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 3 Artur Linhart 2010-03-31 13:11:05 UTC
Great, thank You.
Comment 4 Konstantin Kolinko 2010-06-23 09:08:38 UTC
I like this, but there are caveats implementing this feature:

1. Connectors that fail in a call to initialize() will also likely to fail in start(), pause(), stop(). Thus all the loops over connectors have to be safeguarded.

This includes loops over array returned by StandardService.findConnectors(), e.g. in ServerLifecycleListener#destroyMBeans(Service).


2. Need to reimplement support for 

org.apache.catalina.startup.EXIT_ON_INIT_FAILURE=true

configuration property [1], [2].

[1] http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
[2] https://issues.apache.org/bugzilla/show_bug.cgi?id=48625

As a test case for this feature one can try to start a second instance of Tomcat using the same configuration.

If the above EXIT_ON_INIT_FAILURE setting is added to conf/catalina.properties, Tomcat 6.0.27 will abort startup on the first init() failure.

If the init() exception were caught and startup continued, as proposed patch does, the abort does not happen.
Comment 5 Konstantin Kolinko 2010-06-23 21:47:06 UTC
Created attachment 25633 [details]
2010-06-24_tc6_bug49030.patch

Patch for tc6.0.x
Comment 6 Konstantin Kolinko 2010-06-25 11:24:23 UTC
I ported the patch to TC7 and applied in r957960,

but my testing shows that the fix for bug 48625 included there does not work, because Connector.init() does not behave as expected. I created bug 49503 to track that.
Comment 7 Mark Thomas 2010-09-22 10:56:47 UTC
This has been fixed in 6.0.x and will be included in 6.0.30 onwards.
Comment 8 Mark Thomas 2011-04-12 18:12:06 UTC
*** Bug 46461 has been marked as a duplicate of this bug. ***