On Mon, Feb 6, 2017 at 6:08 PM, Mark Thomas <ma...@apache.org> wrote:
> On 06/02/17 22:55, Mark Thomas wrote:
>>
>> On 06/02/17 21:20, therealnewo...@gmail.com wrote:
>>>
>>> Mark,
>>>
>>> If there is anything I can do to help work on the patch I will,
>>> however as I mentioned in the bug I don't have a windows environment
>>> so I am basically useless if that is where the issues exist.
>>
>>
>> Yes, this is Windows.
>>
>> The problem with the original approach was that DLL_THREAD_DETACH was
>> being called for all threads - including JVM threads stopping after the
>> native library had effectively closed down. Hence the crash.
>>
>> I'm currently trying to use the same approach as used for Linux but I'm
>> not seeing the thread local being destroyed when the associated thread
>> exits. I'm still debugging why.
>>
>> Any hints, suggestions etc. welcome.
>
>
> Looking at the APR docs and source, the destructor function is only called
> when apr_threadkey_private_delete is called and I don't see that being
> called anywhere. How is this working on Linux? I suspect it isn't but I
> haven't set up a build env to confirm that at this point.
>

It should work on linux because pthreads guarantees that the
destructor will be called on thread exit if the value is not NULL. In
fact if you call pthread_key_delete the destructor is explicitly not
called and it is up to the caller to handle any clean up. I used
openssl's approach which obviously does not use apr but uses pthreads
directly and did a rough mapping on apr's approach to thread locals.
WIndows does not have the concept of a destructor for their normal
thread locals so that is why openssl used the thread detatch mechanism
and I did too. I do know that if you use windows fibers instead of
threads there is destructor but I didn't think that was an option with
how tomcat native was being used but I am not an expert.

-nate

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

Reply via email to