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

issue when used with rails and thin server #32

Open
banister opened this issue Feb 20, 2012 · 6 comments
Open

issue when used with rails and thin server #32

banister opened this issue Feb 20, 2012 · 6 comments

Comments

@banister
Copy link
Contributor

It's an issue a user (on #pry) encountered, so i'll just paste some of the chatlog :)

The response was returned to the browser despite the pry session sitting there
 waiting for the connection. I could connect to that session and mess around though it was 
unclear what I was actually manipulating since the response had already been shipped out.
Also, I'm running thin as the webserver here which I think may be EM-based.
But even without the EM.run { target.remote_pry_em } I saw the same behavior.

Hope that's enough for you to figure out what's going on! (if not i can request the user provide more info the next i see him :)

@duncanbeevers
Copy link

Howdy. I'm the one who was working through this. Let me know if you need more detail about how this came about.

@duncanbeevers
Copy link

I just tried this out running WEBrick instead of thin. The browser blocks the request and the pry-remote-em server waits for a connection. I connect and see the correct context. When I exit the pry-remote-em session, the server appears to just hang and no response makes it through.

=> Booting WEBrick
=> Rails 3.2.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
:public is no longer used to avoid overloading Module#public, use :public_folder instead
    from /Users/duncanbeevers/.rvm/gems/ruby-1.9.3-p0-fast@everloop/gems/resque-1.19.0/lib/resque/server.rb:12:in `<class:Server>'
[2012-02-19 20:53:01] INFO  WEBrick 1.3.1
[2012-02-19 20:53:01] INFO  ruby 1.9.3 (2011-10-30) [x86_64-darwin11.3.0]
[2012-02-19 20:53:01] INFO  WEBrick::HTTPServer#start: pid=11037 port=3000
[pry-remote-em] listening for connections on pryem://localhost:6462/
[pry-remote-em] received client connection from 127.0.0.1:57096
[pry-remote-em] remote session terminated (:)

@gruis
Copy link
Owner

gruis commented Feb 20, 2012

Thanks for posting extra details.

To use pry-remote-em as a service in your app you'll need to use a webserver that runs inside the eventmachine loop: thin rainbows, etc.,.

If you can post a portion of the code you are using to run it, hopefully I can get a better handle on what is going on.

I have run a pry-remote-em server inside a sinatra (thin) app with no problem.

@gruis
Copy link
Owner

gruis commented Feb 20, 2012

Also when I've run the service in a sinatra and thin app, I've been doing it with async_sinatra.

https://github.com/raggi/async_sinatra

@duncanbeevers
Copy link

I've been hacking on Pry to allow modification of the behavior of binding.pry through a configuration hook. I've tried a couple of different implementations of binding.pry

The one that produces the behavior originally described:

Pry.config.object_pry_handler = proc do |target, *args|
  EM.run { target.remote_pry_em(*args) }
end

And without the inner EM.run

Pry.config.object_pry_handler = proc do |target, *args|
  target.remote_pry_em(*args)
end

In the latter case the server continues to serve subsequent requests and closes the connection properly, but it doesn't block the request pending termination of the pry-remote-em session like I'd expect.

@gruis
Copy link
Owner

gruis commented Feb 21, 2012

Duncan,
Thanks for the code. I'll give it a try soon.

Caleb

On Feb 20, 2012, at 11:07 PM, Duncan Beevers wrote:

I've been hacking on Pry to allow modification of the behavior of binding.pry through a configuration hook. I've tried a couple of different implementations of binding.pry

The one that produces the behavior originally described:

Pry.config.object_pry_handler = proc do |target, *args|
 EM.run { target.remote_pry_em(*args) }
end

And without the inner EM.run

Pry.config.object_pry_handler = proc do |target, *args|
 target.remote_pry_em(*args)
end

In the latter case the server continues to serve subsequent requests and closes the connection properly, but it doesn't block the request pending termination of the pry-remote-em session like I'd expect.


Reply to this email directly or view it on GitHub:
#32 (comment)

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