Use single AsyncExecutor for all operations #5096
-
Operator creation creates I did a simple test by running 1000 threads each creating an Operator. I saw a lot of daemon threads (Thread-1 ... Thread-1000) in the thread dump and tried to use AsyncOperator constructor accepting I have a static single instance which I created only once:
And then I create Operator like Still seeing massive amount of daemon threads, even though executor supposed to be re-used? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Ok, problem was in closing My understanding is that freeing resources implicitly destroys executor and it had to be re-created. |
Beta Was this translation helpful? Give feedback.
-
Oops, I was just too slow second time when monitoring threads, keeping stream/operator open doesn't help. I checked "All threads" instead of "Finished" and again saw 1000 threads. Also, singleton AsyncExecutor is not "destroyed", I added some dummy code like
and haven't seen this exception, so basically executor is not re-used and it's not that it's being disposed |
Beta Was this translation helpful? Give feedback.
-
@BaurzhanSakhariev could you provide a complete reproduce? I check the code and the With fragmented comments it's hard to understand how your application create threads and how they leak. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi @tisonkun, thanks for checking.
you are absolutely right, I was too focused on the prev discussion about I run my test again but this time I assigned some custom prefix to my threads and can confirm that I see only Thanks! |
Beta Was this translation helpful? Give feedback.
Tested and confirmed that the threads are reused.
Thread-1024 ~ Thread-1035 are OpenDAL threads. The available cores on my laptop are 12.