You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2023/01/06 01:11:26 UTC

[skywalking-java] branch main updated: [Deadlock] Move `Agent-Version` property reading away from the class loading stage (#436)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 3ff8c23d0a [Deadlock] Move `Agent-Version` property reading away from the class loading stage (#436)
3ff8c23d0a is described below

commit 3ff8c23d0a235fbe7759b34e3724f7913cbaae4b
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri Jan 6 09:11:20 2023 +0800

    [Deadlock] Move `Agent-Version` property reading away from the class loading stage (#436)
---
 CHANGES.md                                                             | 1 +
 .../org/apache/skywalking/apm/agent/core/remote/AgentIDDecorator.java  | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index f67237ae94..e8e029ff0a 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -23,6 +23,7 @@ Release Notes.
 * Add support for KafkaClients 3.x.
 * Support to customize the collect period of JVM relative metrics.
 * Upgrade netty-codec-http2 to 4.1.86.Final.
+* Move `Agent-Version` property reading away from the class loading stage to avoid deadlock when use `jarsigner`.
 
 #### Documentation
 
diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AgentIDDecorator.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AgentIDDecorator.java
index 46ad74de14..4149597512 100644
--- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AgentIDDecorator.java
+++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/AgentIDDecorator.java
@@ -40,7 +40,7 @@ import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
  */
 public class AgentIDDecorator implements ChannelDecorator {
     private static final ILog LOGGER = LogManager.getLogger(AgentIDDecorator.class);
-    private static final Metadata.Key<String> AGENT_VERSION_HEAD_HEADER_NAME = Metadata.Key.of("Agent-Version", Metadata.ASCII_STRING_MARSHALLER);
+    private static Metadata.Key<String> AGENT_VERSION_HEAD_HEADER_NAME;
     private String version = "UNKNOWN";
 
     public AgentIDDecorator() {
@@ -61,6 +61,7 @@ public class AgentIDDecorator implements ChannelDecorator {
                     }
                 }
             }
+            AGENT_VERSION_HEAD_HEADER_NAME = Metadata.Key.of("Agent-Version", Metadata.ASCII_STRING_MARSHALLER);
         } catch (Exception e) {
             LOGGER.warn("Can't read version from MANIFEST.MF in the agent jar");
         }