This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 00619a9  Java agent memory leak when enhance `Worker thread` at use 
Thread Pool (#5009)
00619a9 is described below

commit 00619a9a3dbb8c41ff06635abfb89c05a761d6a4
Author: 于玉桔 <zhaoyugu...@apache.org>
AuthorDate: Thu Jul 2 09:27:06 2020 +0800

    Java agent memory leak when enhance `Worker thread` at use Thread Pool 
(#5009)
---
 docs/en/FAQ/Memory-leak-enhance-Worker-thread.md | 32 ++++++++++++++++++++++++
 docs/en/FAQ/README.md                            |  3 ++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/docs/en/FAQ/Memory-leak-enhance-Worker-thread.md 
b/docs/en/FAQ/Memory-leak-enhance-Worker-thread.md
new file mode 100644
index 0000000..fd5d388
--- /dev/null
+++ b/docs/en/FAQ/Memory-leak-enhance-Worker-thread.md
@@ -0,0 +1,32 @@
+### Problem 
+When using a thread pool, `TraceSegment` data in a thread cannot be reported 
and there are memory data that cannot be recycled (memory leaks)
+
+### Example
+``` java
+    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+    executor.setThreadFactory(r -> new Thread(RunnableWrapper.of(r)));
+```
+
+### Reason
+
+* Worker threads are enhanced, when using thread pool. 
+* According to the SkyWalking Java Agent design, when you want to trace cross 
thread, you need to enhance the task thread.
+
+### Resolve
+
+* When using `Thread Schedule Framework`
+Checked SkyWalking Thread Schedule Framework at [SkyWalking Java agent 
supported list](../setup/service-agent/java-agent/Supported-list.md), such as 
Spring FrameWork @Async, which can implement tracing without any modification. 
+
+* When using `Custom Thread Pool`
+Enhance the task thread with the following usage.
+
+```java
+    ExecutorService executorService = Executors.newFixedThreadPool(1);
+    executorService.execute(RunnableWrapper.of(new Runnable() {
+        @Override public void run() {
+            //your code
+        }
+    }));
+```
+See [across thread solution 
APIs](../setup/service-agent/java-agent/Application-toolkit-trace-cross-thread.md)
 for more usage
+
diff --git a/docs/en/FAQ/README.md b/docs/en/FAQ/README.md
index 5a6b78f..0413ee1 100644
--- a/docs/en/FAQ/README.md
+++ b/docs/en/FAQ/README.md
@@ -24,4 +24,5 @@ These are known and common FAQs. We welcome you to contribute 
yours.
 * [No data shown and backend replies with "Variable 'serviceId' has coerced 
Null value for NonNull type 'ID!'"](time-and-timezone.md)
 * [**Unexpected endpoint register** warning after 
6.6.0](Unexpected-endpoint-register.md)
 * [Use the profile exporter tool if the profile analysis is not 
right](../guides/backend-profile-export.md)
-* [Compatible with other javaagent bytecode 
processing](Compatible-with-other-javaagent-bytecode-processing.md)
\ No newline at end of file
+* [Compatible with other javaagent bytecode 
processing](Compatible-with-other-javaagent-bytecode-processing.md)
+* [**Java agent memory leak** when enhance `Worker thread` at use Thread 
Pool](Memory-leak-enhance-Worker-thread.md)

Reply via email to