[ 
https://issues.apache.org/jira/browse/IGNITE-9638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16632062#comment-16632062
 ] 

Pavel Tupitsyn commented on IGNITE-9638:
----------------------------------------

This is caused by {{AttachCurrentThread}} JNI call without matching 
{{DetachCurrentThread}}.
Detaching JVM thread on every call will severely degrade the performance.
We have a number of options:
 * Provide a user-facing API to manually detach the thread (really ugly from 
user perspective)
 * Use platform-specific ways to detect thread exit (DLL_THREAD_DETACH on 
Windows, pthread_key_create on Linux) - this will likely require compiling 
unmanaged DLLs for every platform (ugly from our perspective, less 
cross-platform)
 * Find a way to detach a thread that has exited: this way we can rely on GC, 
ThreadLocals and finalizers to detect a thread exit

> .NET: JVM keeps track of CLR Threads, even when they are finished 
> ------------------------------------------------------------------
>
>                 Key: IGNITE-9638
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9638
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms
>    Affects Versions: 2.6
>            Reporter: Ilya Kasnacheev
>            Assignee: Pavel Tupitsyn
>            Priority: Major
>              Labels: .NET
>             Fix For: 2.8
>
>         Attachments: IgniteRepro.zip
>
>
> When you create a Thread in C#, JVM creates corresponding thread 
> "Thread-NNNN" which is visible in jstack. When C# joins this thread, it is 
> not removed from JVM and is kept around. This means that jstack may show 
> thousands of threads which are not there. Reproducer is attached. It is 
> presumed that memory will be exhausted eventually.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to