microsoft / microsoft/vscode-java-debug

Compound Launch Config Debug Port Clash

未关闭
#1,522 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

I'm running into an issue / potential bug where my compound launch configuration tries to run multiple services with the same java debug port. This seems to be a non-deterministic issue and the launch configurations that succeed vary.

Here's a version of my launch config:

  "version": "0.2.0",
  "configurations": [
    {
      "type": "java",
      "name": "AxonServer",
      "request": "launch",
      "mainClass": "org.springframework.boot.loader.PropertiesLauncher",
      "classPaths": [
        "${workspaceFolder}/build/AxonServer/axonserver.jar"
      ],
      "console": "internalConsole",
      "cwd": "${workspaceFolder}/build/AxonServer",
    },
    {
      "type": "java",
      "name": "EurekaServer",
      "request": "launch",
      "mainClass": "com.company.project.framework.eureka.server.EurekaServerApplication",
      "projectName": "com.company.project.framework-eureka-server",
      "console": "internalConsole",
    },
    {
      "type": "java",
      "name": "Config Service",
      "request": "launch",
      "mainClass": "com.company.project.config.service.ConfigApplication",
      "projectName": "com.company.project-config-service",
      "console": "internalConsole",
    },
    {
      "type": "java",
      "name": "Framework Service",
      "request": "launch",
      "mainClass": "com.company.project.framework.FrameworkApplication",
      "projectName": "com.company.project-framework",
      "console": "internalConsole",
    },
    {
      "type": "java",
      "name": "Command Service",
      "request": "launch",
      "mainClass": "com.company.project.framework.commandservice.CommandApplication",
      "projectName": "com.company.project.framework-command-service",
      "console": "internalConsole",
    },
    {
      "type": "java",
      "name": "Query Service",
      "request": "launch",
      "mainClass": "com.company.project.framework.queryservice.QueryApplication",
      "projectName": "com.company.project.framework-query-service",
      "console": "internalConsole",
    },
    {
      "type": "java",
      "name": "Generation Service",
      "request": "launch",
      "projectName": "com.company.project.generation-generation",
      "mainClass": "org.springframework.boot.loader.launch.JarLauncher",
      "classPaths": [
        "${workspaceFolder}/build/generation.jar"
      ],
      "console": "internalConsole",
      "cwd": "${workspaceFolder}\\build",
    },
  ],
  "compounds": [
  {
    "name": "Start Microservices",
    "configurations": [
      "AxonServer",
      "EurekaServer",
      "Config Service",
      "Framework Service",
      "Command Service",
      "Query Service",
      "Generation Service",
    ],
    "stopAll": true,
  },
]

I get this error for several services on most launch attempts:

Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 45559; nested exception is: 
	java.net.BindException: Address already in use: bind
jdk.internal.agent.AgentConfigurationError: java.rmi.server.ExportException: Port already in use: 45559; nested exception is: 
	java.net.BindException: Address already in use: bind
	at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:491)
ConnectorBootstrap.java:491
	at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:447)
Agent.java:447
	at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:603)
Agent.java:603
... (trimmed)
Caused by: java.net.BindException: Address already in use: bind

When I check that port, one of my other configurations is indeed using that port. This is not a port used by the applications themselves, but presumably the java debug server port. When I stop my applications, those ports are no longer in use. I can also run the non-compound launch configs individually without issue, this is specifically a compound launch config issue.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用提供的 VS Code compound launch configuration 重现故障,并观察多个服务同时启动时 Java debug-agent 端口的分配情况。将 compound launches 与单独运行正常的配置进行比较;完成标准是所有列出的服务都能同时启动,而不会争用同一个调试端口。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。