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

Unable to use Java debugger when JRuby starts another JVM #2028

Closed
jmiettinen opened this issue Oct 7, 2014 · 2 comments
Closed

Unable to use Java debugger when JRuby starts another JVM #2028

jmiettinen opened this issue Oct 7, 2014 · 2 comments
Milestone

Comments

@jmiettinen
Copy link
Contributor

When starting Rails (3.2.18 on OS X) with

JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" bundle exec rails c

That is, launching Rails through bundler with Java debugging agent, JVM dies to the following error:

Listening for transport dt_socket at address: 5005
ERROR: transport error 202: bind failed: Address already in use
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)

This seems to be because bundler ultimately loads Rails::ScriptRailsLoader which starts Rails by running exec RUBY, SCRIPT_RAILS, *ARGV if in_rails_application? which then spawns another JVM and probably the port has not been properly released when the second JVM tries to open it.

I can side-step the problem by JRUBY_OPTS="-J-Djruby.launch.inproc=true -J-Djruby.native.exec=false", but this is slightly unsatisfactory.

@kares kares added this to the Won't Fix milestone Apr 9, 2016
@kares
Copy link
Member

kares commented Apr 9, 2016

there's simply nothing we can do about it - JRuby can not know which commands will launch a sub-JVM

@kares kares closed this as completed Apr 9, 2016
@headius
Copy link
Member

headius commented Apr 9, 2016 via email

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

3 participants