2013/11/11 Mark Thomas <ma...@apache.org>:
> On 10/11/2013 23:06, Konstantin Kolinko wrote:
>> 2013/11/11  <ma...@apache.org>:
>
> Fixed.
>

Looks good.

>> 3. You aren't improving the message reported in Bugzilla, but a different 
>> one.
>>
>> In OP's stacktrace from Tomcat 6:
>>
>> java.lang.Exception: Socket bind failed: [226] Adresse bereits im Zugriff
>>         at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:671)
>>         at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:851)
>>
>> The above is an implicit call to init() from within start().
>>
>> I think that there should have been a previous explicit call to
>> init() that failed and should have printed an error message.
>
> Ah. I see what you mean. That first error message was equally cryptic so
> I fixed that.
>
>> It looks like the message that you are improving should have already
>> been in the logs, but OP failed to notice it.  The "Address already in
>> use" message reported in Bugzilla would still occur when init() is
>> called by the second time.
>
> Agreed.
>
>> I do not know whether repeated call to init() is possible in Tomcat 7
>> (I hope better lifecycles prevent it),
>
> It doesn't appear to happen in trunk.
>
>> but it looks possible in Tomcat 6.
>>
>> In AprEndpoint of Tomcat 6
>> [[[
>>     public void init()
>>         throws Exception {
>>
>>         if (initialized)
>>             return;
>>
>>         // Create the root APR memory pool
>>         rootPool = Pool.create(0);
>> ...
>> ]]]
>>
>> Maybe add a sanity check just below the "if (initialized) return;" lines 
>> above:
>>
>> if (rootPool != 0) then it means that the pool has already been
>> created. In other words, init() has already been called once, but
>> failed.
>
> I'll take a look at a Tomcat 6 specific patch.
>

Regarding the patch,
http://people.apache.org/~markt/patches/2013-11-11-bug55749-tc6.patch

[[[
-        if (initialized)
+        if (initialized || rootPool != 0)
             return;
]]]

The above change in init() means that AprEndpoint.start() wouldn't
notice the failure. It will continue the startup sequence and fail in
some obscure way.

I meant something like this, to make the initialization to fail:
(not tested)
[[[
         if (initialized)
             return;

+        if (rootPool != 0)
+            throw new Exception("AprEndpoint initialization failed.
See previous log messages.");
]]]


Best regards,
Konstantin Kolinko

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

Reply via email to