NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Rails Debugging using NB 6.5/Mongrel not working
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NetBeans Forums -> Ruby Users
View previous topic :: View next topic  
Author Message
Arun Gupta
Posted via mailing list.





PostPosted: Thu Dec 18, 2008 6:35 am    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Can anybody please respond to the comment below ?

Thanks,
-Arun
--
Application Platform, Sun Microsystems, Inc.
Blog: http://blogs.sun.com/arungupta



------ Start of attached email. Subject: RE: Comment: Screencast #26: Develop/Run/Debug Rails application using NetBeans IDE and GlassFish v3 Prelude ------
Benny wrote:

Hi Arun,

thanks for the nicely done, concise screencast.

Debugging RoR in NB6.5 isn't working for me, probably because I got the concept wrong? I am on Mac OSX Leopard, using a MacPorts installation of Ruby / RubyGems.

When I start the NB 6.5 debugger in my RoR project (choosing server side ruby debugging), Firefox will launch with the start page of my RoR project on localhost:3000 (Mongrel). Now, when I navigate to the controller I set my breakpoint in, the breakpoint in the IDE doesn't get hit.

In the NB sessions window, I can see the session being started at localhost:53353. The status is always "starting". Entering the address localhost:53353 in the browser does nothing, the request stalls.

Hence my question: Is it possible debugging my RoR application on Mongrel? If so, how do I set the debugger to work together with it?



----
Respond to this comment at:
http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug#comments

----
Link to comment management page:
http://blogs.sun.com/roller-ui/authoring/comments.rol?weblog=arungupta&bean.entryId=320b25b0-dc7c-49a1-a6a4-9a4e22f23fca



------ End of attached email ------
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Thu Dec 18, 2008 8:23 am    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Arun Gupta wrote:
Quote:
Can anybody please respond to the comment below?

Hi Arun,

could you point Benny here and/or point him to the:

http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-Troubleshooting

I can't access you web pages from home, it always brings down my network
connection for some reason. Might be some some wrong blacklist by my
provider. From work it works.

m.
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Fri Dec 19, 2008 4:08 pm    Post subject: Reply with quote

Hello Arun and Martin,

thank you for helping me with this issue. Like you suggested, I went through all the steps at http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-Troubleshooting and made sure I got all the right versions.

I tried the basic functionality on the command line to test the backend and it did not work. Here is what happened when testing to debug a ruby file:

Code:
webdev:gtg-main lubic$ cd app/controllers/
webdev:controllers lubic$ rdebug-ide _0.3.3_ -p 1234 -d -- application.rb
Waiting for connection on ':1234'
Fast Debugger (ruby-debug-ide 0.3.3) listens on :1234
Starting command read loop
Processing: b application.rb:10
<breakpointAdded no="1" location="application.rb:10"/>
Processing: start
Starting: running program script
webdev:controllers lubic$


...after Starting: running program script, I instantly got back the prompt. It seems like a segmentation fault or similar error. The client session looked like this:

Code:
webdev:~ lubic$ telnet localhost 1234
Trying ::1...
Connected to localhost.
Escape character is '^]'.
b application.rb:10 
<breakpointAdded no="1" location="application.rb:10"/>start
Connection closed by foreign host.


I am on Mac OS X 10.5.6, using a MacPorts installation of Ruby 1.8.7. I Googled a lot but have not found any hint on how to fix this, or what exactly is the culprit here.

If you have any idea what to test now, I would be happy to hear about it. I understand it is not a NetBeans bug now, but still don't know where else to seek help.

Thank you very much!
Ben Lubic
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Fri Dec 19, 2008 4:33 pm    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Ben Lubic wrote:
Quote:
Hello Arun and Martin,

thank you for helping me with this issue. Like you suggested, I went
through all the steps at

http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-Troubleshooting
Quote:
and made sure I got all the right versions.

[...]
Quote:

If you have any idea, I would be happy to hear about it. I
understand it is not a NetBeans bug now, but still don't know where
else to seek help.

Hi Ben,

thanks for adventuring into the testing backend itself, that definitely
helped to narrow the culprit. One quick suggestion is whether you could
try NetBeans 7.0 dev build:

http://wiki.netbeans.org/RubyInstallation#section-RubyInstallation-HowDoIGetTheContinuousBuilds

And try the debugger there. It uses newer version of ruby-debug-ide,
0.4.x, which I've made a bit more aggressive wrt. to inconsistent
states. So it might (or not) fail with more clues. So you will just need
to install ruby-debug-ide-0.4.3:

http://wiki.netbeans.org/RubyDebugging70#section-RubyDebugging70-Troubleshooting

If the problem disappears I will backport appropriate fix into
ruby-debug-ide 0.3.x, so you can use debugger also in 6.5. If not it
will be easier to find the culprit in 7.0 dev, since there is better
logging mechanism, so it will be easier for us to communicate then with
6.5.

Likely not Segmentation Fault, since it should appear in the console (at
least on Linux it is doing so).

For now, just this quick suggestion, since I have to leave now.

m.
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Tue Jan 06, 2009 4:04 pm    Post subject: Still not working Reply with quote

Hi again Martin,

sorry for the long wait. I finally had time to try what you suggested. I Installed NB 7 and the latest ruby-debug-ide gem (0.4.3). Another run of "Checking debugger engine functionality" failed:

rdebug-ide side output
Code:

webdev:controllers ben$ rdebug-ide _0.4.3_ -p 1234 -d -- application.rb
Fast Debugger (ruby-debug-ide 0.4.3) listens on :1234
Starting command read loop
Processing: b application.rb:40
<breakpointAdded no="1" location="application.rb:40"/>
Processing:
<error>
There is no thread suspended at the time and therefore no context to execute ''
</error>
Processing: start
Starting: running program script
webdev:controllers ben$


...and client side input
Code:

webdev:controllers ben$ telnet localhost 1234
Trying ::1...
Connected to localhost.
Escape character is '^]'.
b application.rb:40
<breakpointAdded no="1" location="application.rb:40"/>
<error>There is no thread suspended at the time and therefore no context to execute ''</error>start
Connection closed by foreign host.
webdev:controllers ben$
 


so, no change from using the 0.3.3 ruby-debug-ide gem.

Please let me know what to try next. As I said, I now have NB 7 ready.

Thank you!
Ben Lubic
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Tue Jan 06, 2009 5:41 pm    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Ben Lubic wrote:
Quote:
Hi again Martin,

sorry for the long wait. I finally had time to try what you
suggested. I Installed NB 7 and the latest ruby-debug-ide gem
(0.4.3). Another run of "Checking debugger engine functionality"
failed:

rdebug-ide side output

Code:

webdev:controllers ben$ rdebug-ide _0.4.3_ -p 1234 -d -- application.rb

Fast Debugger (ruby-debug-ide 0.4.3) listens on :1234
Starting command read loop
Processing: b application.rb:40
<breakpointAdded no="1" location="application.rb:40"/>
Processing:
<error>
There is no thread suspended at the time and therefore no context to
execute ''
</error>
[...]

Unfortunately it does not reveal anything new. The error message seems
to be just answer to redundant, harmless new-line emitted by telnet
client.

Could you try the same but with the tracing switch turned on and
explicitly set localhost, i.e.:

rdebug-ide _0.4.3_ -p 1234 -h localhost -d -x -- application.rb

Thanks,

m.
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Wed Jan 07, 2009 8:21 am    Post subject: Output Reply with quote

Hello Martin,

thank you for your reply. I did what you said. Here is the output:


Code:

webdev:controllers ben$ rdebug-ide _0.4.3_ -p 1234 -h localhost -d -x -- application.rb
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:211", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:211", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:214", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:89", threadId=1
trace: location="/usr/local/lib/ruby/1.8/ostruct.rb:74", threadId=1
trace: location="/usr/local/lib/ruby/1.8/ostruct.rb:74", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:111", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:111", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:112", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:112", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:113", threadId=1
Fast Debugger (ruby-debug-ide 0.4.3) listens on localhost:1234
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:91", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:91", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:93", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:94", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:97", threadId=1
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:98", threadId=1
Starting command read loop
Processing: b application.rb:10
<breakpointAdded no="1" location="application.rb:10"/>
Processing: start
Starting: running program script
trace: location="/usr/local/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.3/lib/ruby-debug.rb:101", threadId=1
trace: location="/usr/local/lib/ruby/1.8/ostruct.rb:74", threadId=1
trace: location="/usr/local/lib/ruby/1.8/ostruct.rb:74", threadId=1
trace: location="./application.rb:4", threadId=1
webdev:controllers ben$


Client:
Code:

webdev:~ ben$ telnet localhost 1234
Trying ::1...
Connected to localhost.
Escape character is '^]'.
b application.rb:10
<breakpointAdded no="1" location="application.rb:10"/>start
Connection closed by foreign host.
webdev:~ ben$


Here is application.rb (first 4 lines) :
Code:

# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base



Also, out of curiosity, I tried to test the basic command line functionality on a web server, a completely different machine running under Ubuntu 7.10. What is interesting is I received the exact same output like on my development machine (Mac OSX 10.5.6) shown above. The rdebug-ide process just ends once I type "start" on the client. This puzzles me. Is something in my code the culprit?

I am not sure if this gives you any new information. Please let me know what else you need to see.





Kind regards
Ben
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Wed Jan 07, 2009 9:43 am    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Ben Lubic wrote:
Quote:
Hello Martin,

thank you for your reply. I did what you said. Here is the output:

webdev:controllers ben$ rdebug-ide _0.4.3_ -p 1234 -h localhost -d
-x -- application.rb
[...]
Quote:
Here is application.rb (first 4 lines) :

# Filters added to this controller apply to all controllers in
the application.
Quote:
# Likewise, all the methods added will be available for all
controllers.
Quote:

class ApplicationController < ActionController::Base


I am not sure if this gives you any new information. Please let me
know what else you need to see.

Hi Ben,

I see the problem with our particular case now. I've missed the
important fact in the beginning that the application.rb you are trying
is from Rails application. Which means that the behaviour of the
debugger is correct. Since you've put breakpoint on the line *10* of
application.rb. But the program never reach that point since it fails on
the fourth line with:

application.rb:4: uninitialized constant ActionController (NameError)

There is a bug that the debugger that it does not print out the
exception stacktrace when some is raised which is confusing in states
like this one.

http://www.netbeans.org/issues/show_bug.cgi?id=156118

So could you replace "b application.rb:10" with "b application.rb:4",
i.e. the line:

class ApplicationController < ActionController::Base

Debugger should stop there. After it stops, emitting 'cont' command
should finish the session (due to the above exception raised).

More questions:

1) could you send me the log as described here with the failing Mongrel
scenario:


http://wiki.netbeans.org/RubyDebugging70#section-RubyDebugging70-HowToFileABug

I'm not sure but probably we did not try to analyze logs yet which
might reveal something.

2) does debugging of simple hello_world.rb script works for you in
NetBeans?

Thanks,

m.
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Wed Jan 07, 2009 10:32 am    Post subject: Mongrel Reply with quote

Hello Martin,

okay, I can confirm a simple hello_world.rb file does indeed result in a working debugging session in both the terminal and Netbeans. The breakpoint gets hit.

Debugging my rails application though, my breakpoints do not get hit. I just sent you the IDE log via E-Mail.

Thank You.
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Wed Jan 07, 2009 10:51 am    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Ben Lubic wrote:
Quote:
Hello Martin,

okay, I can confirm a simple hello_world.rb file does indeed result in a working debugging session in both the terminal and Netbeans. The breakpoint gets hit.

Debugging my rails application though, my breakpoints do not get hit. I just sent you the IDE log via E-Mail.

Log seems OK. It just seems that the location with breakpoint were never
executed/interpreted. Are you sure that the place where you've put the
breakpoint is actually interpreted? You might check by butting:

puts "I'm here"

before the place where you have put the breakpoint and:

I'm here

should be printed out to the OW with Mongrel output. Is it the case?

Thanks,
m.
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Wed Jan 07, 2009 11:06 am    Post subject: Reply with quote

Hello Martin,

yes that is indeed the case. The "put" shows on the console. The breakpoint is not hit, though. The application does not stop, and the breakpoint does not turn green.

Back to where we started I guess (hopefully not Wink )

Do you have another idea?
Back to top
Martin Krauskopf
Posted via mailing list.





PostPosted: Wed Jan 07, 2009 11:22 am    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Ben Lubic wrote:
Quote:
Hello Martin,

yes that is indeed the case. The "put" shows on the console. The breakpoint is not hit, though. The application does not stop, and the breakpoint does not turn green.

Back to where we started I guess (hopefully not Wink )

Do you have another idea?

I suppose that just running (not debugging) works for the same scenario
with your Rails application.

I guess I firstly need to fix:

http://www.netbeans.org/issues/show_bug.cgi?id=156118

which might help - might be that some exception which is not thrown when
running is thrown when debugging and due to the bug above it is not
perceptible.

Could you file a bug against ruby/debugger component in our Issuezilla:

http://www.netbeans.org/nonav/issues/enter_bug.cgi?component=ruby&subcomponent=debugger&version=7.0
(one-click registration if you are not already registered)

If not, let me know I'll file it.

Thanks,
m.

PS: something to the log, I'll reply to the email, you've send me
Back to top
Ben Lubic



Joined: 19 Dec 2008
Posts: 6

PostPosted: Wed Jan 07, 2009 11:49 am    Post subject: Bug filed Reply with quote

Hello Martin,

I just filed a bug:
http://www.netbeans.org/nonav/issues/show_bug.cgi?id=156410

and also sent you new logs.

Regards
Ben
Back to top
callagga



Joined: 26 Aug 2008
Posts: 18

PostPosted: Mon Jan 12, 2009 12:07 pm    Post subject: Reply with quote

FYI - I'm having problems running and debugging rspec files in 6.5 too. I see the following:

Left Pane
- No test executed
- Account running...

Right Pane
Fast Debugger (ruby-debug-ide 0.3.1) listens on :64825
[Using spec/spec.opts; create spec/spec.opts.netbeans to set options used under the IDE. Suppress this warning message by adding -J-Druby.rspec.specopts.warn=false to the flags in etc/netbeans.conf]
Finished in seconds
0 examples, 0 failures
Back to top
Erno Mononen
Posted via mailing list.





PostPosted: Mon Jan 12, 2009 12:11 pm    Post subject: Rails Debugging using NB 6.5/Mongrel not working Reply with quote

Hi,

Which version of RSpec are you using? Could you please turn on detailed
logging (http://wiki.netbeans.org/FaqRubyNBLogging), run the specs again
and send the log me?

Thanks,
Erno

callagga wrote:
Quote:
FYI - I'm having problems running and debugging rspec files in 6.5 too. I see the following:



Left Pane

- No test executed

- Account running...



Right Pane

Fast Debugger (ruby-debug-ide 0.3.1) listens on :64825

[Using spec/spec.opts; create spec/spec.opts.netbeans to set options used under the IDE. Suppress this warning message by adding -J-Druby.rspec.specopts.warn=false to the flags in etc/netbeans.conf]

Finished in seconds

0 examples, 0 failures











Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Ruby Users All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo