xiaqi1210 opened a new issue, #10975: URL: https://github.com/apache/skywalking/issues/10975
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues. ### Apache SkyWalking Component Java Agent (apache/skywalking-java) ### What happened The apm-jdk-threadpool-plugin may encounter duplicate enhancement of Runnable or Callable objects, such as the case where it has already been enhanced by RunnableWrapper or CallableWrapper with toolkit. ### What you expected to happen When The apm-jdk-threadpool-plugin encounter duplicate enhancement of Runnable or Callable objects, the same thread invocation may result in the creation of two LocalSpan instances. ### How to reproduce 1. jdk 1.8 2. skywalking agent 8.14.0 3. move apm-jdk-threadpool-plugin to plugins dir. 4. use RunnableWrapper to wrap Runnable when execute in ThreadPoolExecutor ``` ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 1000, TimeUnit.HOURS, new ArrayBlockingQueue<>(10)); executor.execute(RunnableWrapper.of(() -> { log.info("executor.execute"); })); ``` ### Anything else In some old projects, RunnableWrapper or CallableWrapper are used for enhancement. However, in newer code that incorporates the apm-jdk-threadpool-plugin, using wrappers for asynchronous thread execution with ThreadPoolExecutor is no longer necessary. This can lead to the mentioned situation. I believe I can add a check in the apm-jdk-threadpool-plugin to ignore Runnable or Callable objects that have already been enhanced by Skywalking. ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
