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

Play Java 11 JDWP support #1356

Open
danrods opened this issue May 11, 2021 · 2 comments
Open

Play Java 11 JDWP support #1356

danrods opened this issue May 11, 2021 · 2 comments

Comments

@danrods
Copy link

danrods commented May 11, 2021

Are you looking for help?

This is an issue when with the new updated versions of play 1.5.x that allows support for Java 11.
The code itself can run on Java 11 but there's no support from the runner for JDWP

Play Version (1.5.x / etc)

v 1.5.3

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

Docker image openjdk:11-jre-slim

Linux 8a5a886fc0d3 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 GNU/Linux

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing)

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. WHEN invoking play run in a dev environment
  2. AND the java_version is one of the supported versions in Play 1.5.3 ( i.e java version 9, 10, 11)
  3. THEN the new command line option for JDWP since Java 9 should be used
    (i.e -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8000 )

Actual Behavior

  1. When attaching a debugger on port 8000 in dev mode the connection closes immediately
  2. When attempting to add the new argument for JDWP since java 9:
    i.e play run --%dev -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8000

Play fails to start with the error

ERROR:   Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
                Error occurred during initialization of VM
                agent library failed to init: jdwp
  1. There is no way to remove the redundant JDWP options while running in dev mode, because of the following logic in the python runner https://github.com/playframework/play1/blob/1.5.3/framework/pym/play/application.py#L308

Potential Fix

On line https://github.com/playframework/play1/blob/1.5.3/framework/pym/play/application.py#L305

  if application_mode == 'dev':
      self.check_jpda()
      java_args.append('-Xdebug')
      if javaVersion.startswith("9") or javaVersion.startswith("10") or javaVersion.startswith("11"):
         java_args.append('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:%s' % self.jpda_port)
     else
         java_args.append('-Xrunjdwp:transport=dt_socket,address=%s,server=y,suspend=n' % self.jpda_port)
     java_args.append('-Dplay.debug=yes')

Thanks for the help in advance for any workarounds or fixes that come from this. I'm ok to Fork and open a PR if warranted

@cies
Copy link
Contributor

cies commented Sep 8, 2021

Possibly a dupe of (and/or fix for) #1331

@danrods
Copy link
Author

danrods commented Dec 22, 2023

@cies - I take it this was fixed in v1.7.0 alongside #1331 ?

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