https://bz.apache.org/bugzilla/show_bug.cgi?id=59797

--- Comment #6 from Konstantin Kolinko <knst.koli...@gmail.com> ---
The thread pool patch has RAT / checkstyle issues.

The native side patch has the following fragment:

> #if (OPENSSL_VERSION_NUMBER < 0x10000000L) || defined(OPENSSL_USE_DEPRECATED)
>     ERR_remove_state(0);
> #elif (OPENSSL_VERSION_NUMBER < 0x10100000L)
>     ERR_remove_thread_state(NULL);
> #endif

I do not understand "|| defined(OPENSSL_USE_DEPRECATED)" part of the above
condition. I think that ERR_remove_thread_state() is the correct cleanup
function and shall be used as soon as it is available, so the
OPENSSL_USE_DEPRECATED part of the condition should be removed.

Motivation:

1. Looking into implementation of ERR_remove_state() in crypto/err/err.c of
openssl-1.0.2d  it ignores its argument. I think such implementation is bad and
should not be invoked.

#ifndef OPENSSL_NO_DEPRECATED
void ERR_remove_state(unsigned long pid)
{
    ERR_remove_thread_state(NULL);
}
#endif

2. Deprecation of ERR_remove_state() is clearly mentioned in CHANGES file of
openssl-1.0.2d as a change "between 0.9.8n and 1.0.0  [29 Mar 2010]". I see no
reason to call the old function. Also OpenSSL 0.9.8 is no longer supported.
Tomcat-Native 1.2.x requires OpenDDL 1.0.2+ (as documented in native/BUILDING
file).


(In reply to Mark Thomas from comment #5)
> Fixing it in the thread pool is good in that the calls to clean are
> minimized. But this excludes calls from non-container threads.

ERR_remove_thread_state() can be called with an explicit thread id. If we know
ids for threads that completed execution (and are gc'ed) we can perform cleanup
for them from a different thread.

I think that monitoring of completed (gc'ed) threads can be performed with a
WeakReference and a ReferenceQueue that is processed by a background thread.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to