ruby-debug / ruby-debug-ide

An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
https://www.jetbrains.com/ruby/features/ruby_debugger.html
Other
370 stars 83 forks source link

debugging breaks on a IDEA Jruby/vertx project , no clue #184

Open amiracam opened 4 years ago

amiracam commented 4 years ago

on the most innocent of setups one would think the debugger breaks with the following stack:

Fatal exception in DebugThread loop: closed stream Backtrace: org/jruby/ext/socket/RubyTCPServer.java:157:in accept' from: :1:inblock in ' Exception in thread "Ruby-0-Thread-1: C:/jruby-9.2.8.0/lib/ruby/gems/shared/gems/ruby-debug-ide-0.7.0.beta7/lib/ruby-debug-ide.rb:117" java.lang.NullPointerException at org.jruby.internal.runtime.ThreadService.getMainThread(ThreadService.java:231) at org.jruby.RubyThread.exceptionRaised(RubyThread.java:1786) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:112) at java.lang.Thread.run(Thread.java:748)

I have one script that deploys a verticle i.e. another script is invoked on another thread from my understanding, this is part of the underlying machinery of vertx , placing a break point in that second rb file, generates the above

Any ideas ? Anything that I can do to further provide more info for this issue ? thanks

amiracam commented 4 years ago

btw, I should add since I just noticed that this error occurs without having any breakpoints setup in IDEA i.e. just launching this script in debug mode with IDEA will cause the issue

on the other hand if I place a breakpoing on an Rspec test I do NOT encounter the issue running in debug mode and the debugger will stop at the breakpoints specified

these are the versions of the gems in question: Evaluation memory limit is ineffective in JRuby and MRI < 2.0 Fast Debugger (ruby-debug-ide 0.7.0.beta7, ruby-debug-base 0.10.6, file filtering is supported) listens on 0.0.0.0:57152

amiracam commented 4 years ago

nothing ?

ViugiNick commented 4 years ago

@amiracam What jruby version do you use?

ViugiNick commented 4 years ago

@amiracam Fixed in ruby-debug-base 0.11.0

amiracam commented 4 years ago

unfortunately , still occurring even when explicitly loaded via a Gemfile 👍 Evaluation memory limit is ineffective in JRuby and MRI < 2.0 Fast Debugger (ruby-debug-ide 0.7.1.beta3, ruby-debug-base 0.11.0, file filtering is supported) listens on 0.0.0.0:49876 Exception in thread "Ruby-0-Thread-1: C:/jruby-9.2.9.0/lib/ruby/gems/shared/gems/ruby-debug-ide-0.7.1.beta3/lib/ruby-debug-ide.rb:139" java.lang.NullPointerException at org.jruby.internal.runtime.ThreadService.getMainThread(ThreadService.java:232) at org.jruby.RubyThread.exceptionRaised(RubyThread.java:1816) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:112) at java.lang.Thread.run(Thread.java:748) Fatal exception in DebugThread loop: closed stream Backtrace: org/jruby/ext/socket/RubyTCPServer.java:157:in accept' from: :1:inblock in ' Jan 16, 2020 10:24:24 PM io.vertx.core.impl.VertxImpl WARNING: You're already on a Vert.x context, are you sure you want to create a new Vertx instance?

ViugiNick commented 4 years ago

@amiracam Are you sure port 49876 is opened on your machine?

amiracam commented 4 years ago

interesting question, I'm logged in as an administrator on a Win 10 box and the times what I believe you are referring to has come up I encounter a dialog from the OS asking to allow access. That is not the case for these scenarios i.e. such prompt does not come up. So basically is somehow UAC getting in the way? that port is of course dynamically specified so it would be a general issue. The port closes out immediately so I can't tell if it opened and closed right away. There is evidence however, that Idea can open these ports as per the following:

debugJrubyIssue

Unfortunately for me the issue is more complicated because there are circumstances when the debugger works for example, a silly MiniTest will startup:

Testing started at 1:26 PM ... C:\jruby-9.2.10.0-SNAPSHOT\bin\jruby.exe -J-cp C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-lang-ruby\3.8.4\d40d9a583ffa6cc13b5c3c565866e223a76d61da\vertx-lang-ruby-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-web\3.8.4\15ddd6bc49462bc2f44827f634a14155a55435d2\vertx-web-3.8.4.jar;C:\Users\Charles\IdeaProjects\DataFeeds\src\main\jruby;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-lang-ruby-gen\3.8.4\f190d41e9ddf36c0443a6a64093668f723c0740d\vertx-lang-ruby-gen-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-web-common\3.8.4\95df86101134455c2c7048bcd3734bb0e81b7d9f\vertx-web-common-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-auth-common\3.8.4\6cce0e75b7fc4c1dcab7ba0a6a0854d7b5d6215a\vertx-auth-common-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-core\3.8.4\f046076d52d93fb523104fe9470819cec7537f69\vertx-core-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\org.jruby\jruby-complete\9.2.8.0\2dbdff9d9f4142e4a0bc2b743ded9487a80459ef\jruby-complete-9.2.8.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\ojdbc8\19.3.0.0\967c0b1a2d5b1435324de34a9b8018d294f8f47b\ojdbc8-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\org.postgresql\postgresql\42.2.8\6f394c7df5600d11b221f356ff020440d2ece44f\postgresql-42.2.8.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.microsoft.sqlserver\mssql-jdbc\7.4.1.jre8\934e92cd5eac5f0edb0298f13693e49e76fdd917\mssql-jdbc-7.4.1.jre8.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.25\8b6e01ef661d8378ae6dd7b511a7f2a33fae1421\snakeyaml-1.25.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-handler-proxy\4.1.42.Final\7b816d9f37ddcb68f6c1b9b0d7b5a98bfac40911\netty-handler-proxy-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-http2\4.1.42.Final\819e7b5f2005770cf7558c04276fff080331c6df\netty-codec-http2-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-http\4.1.42.Final\5f71267aa784d0e6c5ec09fb988339d244b205a0\netty-codec-http-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-handler\4.1.42.Final\fc6546be5df552d9729f008d8d41a6dee28127aa\netty-handler-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-resolver-dns\4.1.42.Final\385e8b85dce81f8ac61d8b161c5b39020b5d789f\netty-resolver-dns-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-socks\4.1.42.Final\dd355f01dc00f93aaebe805b05026d7cf57c60ec\netty-codec-socks-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-dns\4.1.42.Final\67528de727bae6c4a2ff4dce0afa2a4c3c8f60bd\netty-codec-dns-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-codec\4.1.42.Final\b1d5ed85a558fbbadc2783f869fbd0adcd32b07b\netty-codec-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-transport\4.1.42.Final\857502e863c02c829fdafea61c3fda6bda01d0af\netty-transport-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-buffer\4.1.42.Final\6e6fc9178d1f1401aa0d6b843341efb91720f2cd\netty-buffer-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-resolver\4.1.42.Final\ccaacf418a9e486b65e82c47bed66439119c5fdb\netty-resolver-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.netty\netty-common\4.1.42.Final\e02700b574d3a0e2100308f971f0753ac8700e7c\netty-common-4.1.42.Final.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.9.9.1\211dfab27bdd15a569247fee4690a07a177044f8\jackson-databind-2.9.9.1.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.9.9\bfff5af9fb8347d26bbb7959cb9b4fe9a2b0ca5e\jackson-core-2.9.9.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\io.vertx\vertx-bridge-common\3.8.4\13a431c59b3c580ace21c7ba0fe3d183104ce78a\vertx-bridge-common-3.8.4.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\ucp\19.3.0.0\796b661b0bb1818b7c04171837356acddcea504c\ucp-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\oraclepki\19.3.0.0\e52a34f271c6c62ee1a73b71cc19da5459b709f\oraclepki-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\osdt_cert\19.3.0.0\c134652fdcb17ff72963d386efd8ade902d2eaff\osdt_cert-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\osdt_core\19.3.0.0\2e01c262879c97de876c238966eb1da48542f2e8\osdt_core-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\simplefan\19.3.0.0\bcbfbb3cc529995f33c8694eb7cbc605c129e4e6\simplefan-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.oracle.ojdbc\ons\19.3.0.0\cf3f3ef525c61a27fe9952652a156ddd738b1cd5\ons-19.3.0.0.jar;C:\Users\Charles.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.9.0\7c10d545325e3a6e72e06381afe469fd40eb701\jackson-annotations-2.9.0.jar -X+O -J-Djruby.compile.mode=OFF -J-Djruby.debug.fullTrace=true C:\jruby-9.2.10.0-SNAPSHOT\lib\ruby\gems\shared\gems\ruby-debug-ide-0.7.1.beta3\bin\rdebug-ide --key-value --disable-int-handler --evaluation-timeout 10 --evaluation-control --time-limit 100 --memory-limit 0 --rubymine-protocol-extensions --port 61148 --host 0.0.0.0 --dispatcher-port 61149 -- C:/Users/Charles/IdeaProjects/DataFeeds/src/test/java/test_something_test.rb Evaluation memory limit is ineffective in JRuby and MRI < 2.0 Fast Debugger (ruby-debug-ide 0.7.1.beta3, ruby-debug-base 0.11.0, file filtering is supported) listens on 0.0.0.0:61148 Started

So ITS NOT A PORT ISSUE , I had for a second wished that was all it was.

In the former case I'm starting a Vertx process which will start successfully in "run" mode but obviously the same code in the context of a debugger session will not start. I haven't explored what other setups might break the debugger but it does work in some circumstances I.e. simple MiniTest and will not work with perhaps something that is threaded like Vertx. I should try to see if debugging a Sinatra app will work. All of this btw, at one point in time did work i.e. in the 9.1.x line. I had to take a hiatus from this project and ported to Jruby latest stable when I cycled back to it. Do note that I'm using 9.2.10.0 snapshot but the reason I literally went there yesterday was in case it might resolve the issue.

thanks for the assistance, I can't move this to production without a viable debugging process

amiracam commented 4 years ago

So more unfortunate news to report well for me :) , I can get a Sinatra app up into a debugging session , mind you its a dumb app yet , I can put a breakpoint into a route without issue, so this is now more leading into some issue with Vertx and I say Vertx as opposed to my app since I'm actually testing with a very simple Vertx app where I simply deploy a verticle that is an http service with a couple of routes