-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
Unexpected thread behavior inside debugger context #115
Comments
@mhoran Thanks, that's very helpful. I'll get to this soon! |
I'll commit a fix for this in the next days. |
So I've fixed the issue you reported but I'm pretty sure the other issue will still happen. So what would be the steps to reproduce it? The issue you linked to seems to the same as the one I've fixed (because they both happen when evaluating stuff from byebug/pry-byebug's prompt) although it is true that the errors are different. |
I've been unable to extract a simple test case, but I do have a simple app that exhibits the behavior. Clone the app and check out the There's nothing special about the app; it's just a Rails app that I test capybara-webkit features against. I see this behavior in Ruby 2.0 through 2.2. This behavior should also be reproducible with a fresh Rails app, but I've set this one up with examples. If you have any questions about the internals of capybara-webkit and what may be causing the hang, let me know. However, the sample code above basically represents the related capybara-webkit implementation. Removing |
I've added some other commits that should fix the other issue. It was the same issue but my first fix was not complete. I think all issues reported here happen when evaluating stuff from |
Awesome! This looks to be working now. I didn't realize that One thing that still hangs is The WEBrick thread will normally be running by the time we get to the debug prompt, so long as a visit has occurred before |
@mhoran I've added a failing test case for the new issue. It looks like a valid one to me. I think whatever I'm not sure how to fix it though, it looks like my first fix is not valid and I need to rethink the whole thing. Hope to come up with something in the next days. |
@mhoran It should be fixed now! Please don't find yet another bug that invalids everything 😄 Actually I haven't tried your sample app, only my test case. Could you try the sample app and confirm it's working? |
Sample app confirms all is well. Thanks for working through this! |
Thanks for identifying the issues and making them easy to reproduce! |
@deivid-rodriguez I spoke to @mhoran about this and I assume it's the same issue we have with byebug 5.0, pry-byebug 3.1 and the heads of master for those. See also deivid-rodriguez/pry-byebug#51. Basically we get a hang when doing a "binding.pry" on a capybara-webkit spec run. Webkit debug indicates that it returned, e.g., "page.driver.version," but we never see the output on the debugger. |
I'm going to reopen this cause there's something definitely not quite working here. I've also run very sporadicly into deadlocks with the latests versions. |
@andrewfader I've pushed some drastic changes in how |
@deivid-rodriguez Thanks! Unfortunately these changes seem to break pry-byebug. I made a pull request to fix an error I was getting on Gemfile require about Byebug::Processor, but it now complains that "undefined method `handler=' for Byebug:Module" when I try to do a binding.pry. I assume there are some more changes that need to be done in pry-byebug |
Of course, I meant you to try just |
Thanks! Appreciate the prompt replies and fixes! |
Try https://github.com/deivid-rodriguez/pry-byebug/tree/support_latest_byebug. You have to explicitly add |
Gem works now but I'm not sure that the hanging has been fixed. I get into a pry like this: [1] pry(#RSpec::ExampleGroups::...)> page.driver.version Then it hangs. Could be a problem lower down? Capybara-puma, capybara-webkit etc? Using: gem 'pry-byebug', github: 'deivid-rodriguez/pry-byebug', branch: 'support_latest_byebug' |
So basically you're getting the same behavior as before, right? |
Seems that way |
Ok. I won't get to this in a while, but if you can create a repo with instructions to reproduce, it'd be great. |
So I made a small repo here: https://github.com/andrewfader/minimal_byebug_hang
|
Hei, great. Last thing, is this reproducible using |
Interesting, no, it actually seems to work fine if I remove pry and pry-byebug and use a debugger statement instead.
|
Interesting indeed, but good news too. Could you reopen this in |
This still happens to me and I don't use pry in any way byebug (5.0.0)
|
Reproduce against latest master if you want this reopened, please. |
It is fixed on master, is there going to be a release soon? |
Yes! |
Sorry if I missed it, but what commit(s) was this fixed in? |
I don't remember. If you have trouble with the latest version, just open a separate issue. |
In capybara-webkit, we use threads to work around a JRuby bug in
IO.select
. This causes an issue when commands are sent to thewebkit_server
process from within a debugger context. The issue persists on master, so I'm opening this issue to document my findings.A simple test case does not behave as expected:
Calling
read
frommain
results intest.rb:5:in
join': No live threads left. Deadlock? (fatal)`. While seemingly related to #54, this issue persists on master.Here's a test case that's more similar to what we do in capybara-webkit:
This results, again, in
test.rb:31:in
join': No live threads left. Deadlock? (fatal)`.Oddly, when capybara-webkit is utilized by a project and the
#read
method is invoked, one does not see this error but instead, the debugger hangs. This has been documented in deivid-rodriguez/pry-byebug#51. Unfortunately, I've been unable to isolate this behavior, but it is reproducible with the latest version of capybara-webkit.The text was updated successfully, but these errors were encountered: