Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compound Launch Config Debug Port Clash #1522

Open
sylphrena0 opened this issue Nov 5, 2024 · 2 comments
Open

Compound Launch Config Debug Port Clash #1522

sylphrena0 opened this issue Nov 5, 2024 · 2 comments

Comments

@sylphrena0
Copy link

sylphrena0 commented Nov 5, 2024

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.

@SunBK201
Copy link

I also encountered the same problem, the compounds configuration caused port conflicts.

@SunBK201
Copy link

SunBK201 commented Dec 28, 2024

I found a workaround, and we can customize different jmx ports to each different configuration to bypass conflicts:

"vmArgs": [
    "-Dcom.sun.management.jmxremote.port=<Your custom port>",
    "-Dcom.sun.management.jmxremote.authenticate=false",
    "-Dcom.sun.management.jmxremote.ssl=false",
],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants