py4j / py4j

Py4J enables Python programs to dynamically access arbitrary Java objects

Home Page:https://www.py4j.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

launch_gateway fails to parse server port when enabling a JVM debug port

ehigham opened this issue · comments

When calling launch_gateway with javaopts=['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005'] it'll fail to parse the server port from stdout:

File py4j/java_gateway.py:337, in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth, cwd, return_proc, use_shell)
    331 proc = Popen(
    332     command, stdout=PIPE, stdin=PIPE, stderr=stderr, cwd=cwd,
    333     **popen_kwargs)
    335 # Determine which port the server started on (needed to support
    336 # ephemeral ports)
--> 337 _port = int(proc.stdout.readline())
    339 # Read the auth token from the server if enabled.
    340 _auth_token = None

ValueError: invalid literal for int() with base 10: b'Listening for transport dt_socket at address: 5005\n'

Thanks for reporting this. Are you interested in making a PR?

Thanks for reporting this. Are you interested in making a PR?

Sure :)

@HyukjinKwon can someone take a look at the PR please?