Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Errno::EPIPE: Broken pipe #68

Closed
xaviershay opened this issue May 29, 2011 · 31 comments
Closed

Errno::EPIPE: Broken pipe #68

xaviershay opened this issue May 29, 2011 · 31 comments

Comments

@xaviershay
Copy link

I sporadically get the following error:

Errno::EPIPE: Broken pipe
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `write'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `puts'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:45:in `command'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit/browser.rb:18:in `find'
  capybara-webkit-0.4.0/lib/capybara/driver/webkit.rb:28:in `find'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:156:in `find_in_base'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:121:in `block in all'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `map'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:120:in `all'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:38:in `block in has_selector?'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `block in wait_conditionally_until'
  capybara-0.4.1.2/lib/capybara/session.rb:222:in `block in wait_until'
  capybara-0.4.1.2/lib/capybara/util/timeout.rb:13:in `timeout'
  capybara-0.4.1.2/lib/capybara/session.rb:222:in `wait_until'
  capybara-0.4.1.2/lib/capybara/node/finders.rb:164:in `wait_conditionally_until'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:37:in `has_selector?'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:121:in `has_xpath?'
  capybara-0.4.1.2/lib/capybara/node/matchers.rb:184:in `has_content?'
  capybara-0.4.1.2/lib/capybara/session.rb:264:in `method_missing'

I am running my acceptance specs in parallel, if that is relevant.

@fwoeck
Copy link

fwoeck commented May 30, 2011

Hi, I see that too (ruby192, osx1067, guard, spork084) - primarily the very first time after I restarted the spork server. So it's a timing problem probably.
--Frank

@fwoeck
Copy link

fwoeck commented May 31, 2011

Do you have
$.ajaxSetup({ async: true });
for your tests? See #71
--Frank

@xaviershay
Copy link
Author

I don't have any JS - I'm testing the following rack application:

class MyApp
  def call(env)
    if env['PATH_INFO'] == '/home'
      [200, {'Content-Type' => 'text/plain'}, ["Hello world!"]]
    else
      [200, {'Content-Type' => 'text/plain'}, [""]]
    end
  end
end

@lazylester
Copy link

I'm seeing a similar problem. Repeatbly, in exactly the same place every time in my test suite. When I bypass webkit and use selenium for the failing test, the broken pipe error occurs on the next webkit test. And if I bypass webkit on that one, the error occurs on the next webkit test.

Broken pipe (Errno::EPIPE)
capybara-webkit-b6a09ee0bf3f/lib/capybara/driver/webkit/browser.rb:45:in `write'
capybara-webkit-b6a09ee0bf3f/lib/capybara/driver/webkit/browser.rb:45:in `puts'
capybara-webkit-b6a09ee0bf3f/lib/capybara/driver/webkit/browser.rb:45:in `command'
capybara-webkit-b6a09ee0bf3f/lib/capybara/driver/webkit/browser.rb:22:in `reset!'
capybara-webkit-b6a09ee0bf3f/lib/capybara/driver/webkit.rb:76:in `reset!'
capybara-1.0.0/lib/capybara/session.rb:70:in `reset!'
capybara-1.0.0/lib/capybara/dsl.rb:74:in `reset_sessions!'
capybara-1.0.0/lib/capybara/dsl.rb:74:in `each'
capybara-1.0.0/lib/capybara/dsl.rb:74:in `reset_sessions!'
capybara-1.0.0/lib/capybara/cucumber.rb:10:in `After'

@bcardarella
Copy link

Any updates on this?

@sardaukar
Copy link

Curious about the updates too...

@leehambley
Copy link
Contributor

just a thought, but how does parallelizing your tests affect capybara webkit, if it forks after capybara webkit server starts, you'll have two clients sharing the same socket, that would result in this failure?

@jasonm
Copy link
Contributor

jasonm commented Sep 17, 2011

I still see this, just tried switching out selenium for capybara-webkit master on a project (one I'm working on with @hgimenez):

  Scenario: A patient with no family history assigned                           # features/user/assign_family_history_to_patient.feature:17
    Then the "VITALS" tab should be active                                      # features/step_definitions/html_steps.rb:48
    When I follow "Social/Family" within the additional info tabs               # features/step_definitions/web_steps.rb:36
    Then the "SOCIAL/FAMILY" tab should be active                               # features/step_definitions/html_steps.rb:48
    And I should see "Assign Now" within the family history section             # features/step_definitions/web_steps.rb:36
    When I follow "Assign Now" within the family history section                # features/step_definitions/web_steps.rb:36
      No response received from the server. (Capybara::Driver::Webkit::WebkitNoResponseError)
      (eval):2:in `click_link'
      ./features/step_definitions/web_steps.rb:58:in `/^(?:|I )follow "([^"]*)"$/'
      features/user/assign_family_history_to_patient.feature:22:in `When I follow "Assign Now" within the family history section'
    Then the "Family History" field should be focused                           # features/step_definitions/form_steps.rb:71
    When I fill in "Family History" with "History of baconizers"                # features/step_definitions/web_steps.rb:61
    And I press "Save"                                                          # features/step_definitions/web_steps.rb:53
    Then I should see "History of baconizers" within the family history section # features/step_definitions/web_steps.rb:36
    And I should not see "Assign Now" within the family history section         # features/step_definitions/web_steps.rb:36
    And I see the edit family history link                                      # features/step_definitions/selector_steps.rb:5
      Broken pipe (Errno::EPIPE)
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/bundler/gems/capybara-webkit-f493b22f6bb5/lib/capybara/driver/webkit/browser.rb:66:in `write'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/bundler/gems/capybara-webkit-f493b22f6bb5/lib/capybara/driver/webkit/browser.rb:66:in `puts'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/bundler/gems/capybara-webkit-f493b22f6bb5/lib/capybara/driver/webkit/browser.rb:66:in `command'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/bundler/gems/capybara-webkit-f493b22f6bb5/lib/capybara/driver/webkit/browser.rb:32:in `reset!'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/bundler/gems/capybara-webkit-f493b22f6bb5/lib/capybara/driver/webkit.rb:85:in `reset!'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.0.1/lib/capybara/session.rb:70:in `reset!'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.0.1/lib/capybara/dsl.rb:74:in `block in reset_sessions!'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.0.1/lib/capybara/dsl.rb:74:in `each'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.0.1/lib/capybara/dsl.rb:74:in `reset_sessions!'
      /Users/jason/.rvm/gems/ruby-1.9.2-p290/gems/capybara-1.0.1/lib/capybara/cucumber.rb:10:in `After'

@halogenandtoast @jferris do you guys ever see this on an app?

@jferris
Copy link
Contributor

jferris commented Sep 19, 2011

A broken pipe happens when the webkit_server binary crashes, so it always indicates a bug in capybara-webkit. Unfortunately, it's frequently difficult to find out what actually caused it to crash. What actually happens when you follow "Assign Now" in the above scenario?

@jasonm
Copy link
Contributor

jasonm commented Sep 19, 2011

"Assign Now" is a placeholder link for a set of unassigned attributes on a Patient model. When you click it, the placeholder markup is replaced with an editable form in a Backbone.js view. The link is "#edit-family-history" and click is bound to renderForm in this view: https://gist.github.com/dddd26ba632cdac725ba

@tmaier
Copy link

tmaier commented Sep 28, 2011

I have the same problem.

If i run my js: true related specs individually, they pass.
But when I run more then one spec with js: true, the second fails with Errno::EPIPE: Broken pipe

I tried now for one hour to nail it down to a as simple as possible example.
But unfortunately I could not find one.
Even simple examples with just one visit and fill_in tend to fail, but not always.

If there is any way how I can assist you to find the error, I'm happy to help.

@carlhoerberg
Copy link

when using :webkit_debug we don't get these broken pipe errors.. (newly installed ubuntu 11.04 machine, mac os lion no such errors even with the normal :webkit driver)

@tmaier
Copy link

tmaier commented Sep 28, 2011

Thank you @carlhoerberg for this hint.

I tried it. The first one still passes, starting from the second one it fails.

[first one omitted]
People
  POST /people/12345/destroy
 >> Visit
 >> 1
 >> 36
 >> http://127.0.0.1:65185/users/sign_in
 << 
 >> Reset
 >> 0
    destroy person (FAILED - 1)

Projects
 >> Visit
 >> Reset
  works (FAILED - 2)
 >> Visit
 >> Reset
  works also (FAILED - 3)

WorkBreakdownStructures
  GET /projects/12345/work_breakdown_structures/12345/destroy
 >> Visit
 >> Reset
    destroy work breakdown structure (FAILED - 4)

Failures:

  1) People POST /people/12345/destroy destroy person
     Failure/Error: login_as user
     Capybara::Driver::Webkit::WebkitNoResponseError:
       No response received from the server.
     # ./spec/support/auth_methods.rb:14:in `login_as'
     # ./spec/requests/people_spec.rb:12:in `block (2 levels) in <top (required)>'

  2) Projects works
     Failure/Error: visit root_path
     Errno::EPIPE:
       Broken pipe
     # ./spec/requests/projects_spec.rb:199:in `block (2 levels) in <top (required)>'

  3) Projects works also
     Failure/Error: visit root_path
     Errno::EPIPE:
       Broken pipe
     # ./spec/requests/projects_spec.rb:210:in `block (2 levels) in <top (required)>'

  4) WorkBreakdownStructures GET /projects/12345/work_breakdown_structures/12345/destroy destroy work breakdown structure
     Failure/Error: login_as user
     Errno::EPIPE:
       Broken pipe
     # ./spec/support/auth_methods.rb:14:in `login_as'
     # ./spec/requests/work_breakdown_structures_spec.rb:8:in `block (2 levels) in <top (required)>'```

@joshuaclayton
Copy link
Contributor

Also seeing these issues, but there's no rhyme or reason. The test suite's been running for a couple hours fine but then different steps start failing. Running the scenarios individually don't result in the exception.

Running against thoughtbot/capybara-webkit HEAD.

[ ~/dev/project webkitupgrade ✔ ] ps aux | grep webkit_server
joshuaclayton  44486   0.2  0.5  4686236  46064 s002  S     3:29PM   0:21.21 /Users/joshuaclayton/.rvm/gems/ruby-1.9.2-p180/bundler/gems/capybara-webkit-eeeddbd07241/bin/webkit_server
joshuaclayton  50944   0.0  0.6  4686180  50936 s002  S    11:53AM   0:54.49 /Users/joshuaclayton/.rvm/gems/ruby-1.9.2-p180/bundler/gems/capybara-webkit-cc2e9486a0ce/bin/webkit_server
joshuaclayton  82645   0.0  0.0        0      0 s002  Z    10:08AM   0:00.00 (webkit_server)
joshuaclayton  28948   0.0  0.0  2426700    340 s013  S+   11:53AM   0:00.00 grep webkit_server

@jferris
Copy link
Contributor

jferris commented Oct 1, 2011

I think this could be a duplicate of #39. Can you guys try again on 0.7.1? If you keep running into issues, please open a new issue and include output from :webkit_debug.

@jferris jferris closed this as completed Oct 1, 2011
@tmaier
Copy link

tmaier commented Oct 4, 2011

Thank you @jferris, but the update did not solve my issue.
I created a followup issue #181.

@FlaviuSim
Copy link

I was having this issue on 0.6.1 (especially with devise paths (e.g.: visit login_path)).

After upgrading to 0.7.2, the problem was solved. Just an fyi for the people coming to this page like I did.

Thank you for making testing easier.

@enricribas
Copy link

We are still having the same issue with capybara-webkit 0.7.2
Running integration test passes when run individually but fails when an integration test with js=> true runs (and passes) before it.
The test that fails does not have js=>true needed. This second tests fails with 'broken pipe'.

Any ideas greatly appreciated. Thanks.

@iRonin
Copy link

iRonin commented Sep 19, 2012

I'm getting Errno::EPIPE: Broken pipe on e39a5c9 but it's working fine on e677cb9

@mhoran
Copy link
Collaborator

mhoran commented Sep 19, 2012

@iRonin, this is likely related to the segfaults being discussed in #376. The logging introduced in d9b1898 makes the errors more prevalent. If you run with Qt 4.7.4 the segfaults will likely go away.

@iRonin
Copy link

iRonin commented Sep 19, 2012

@mhoran Thanks, I'll try to give it a go :)

@kylewelsby
Copy link

Im running QT 4.8.4 and I get

Capybara::Driver::Webkit::WebkitNoResponseError:
       No response received from the server.

then on the next example

Errno::EPIPE:
       Broken pipe

@haarts
Copy link

haarts commented Dec 18, 2012

+1
Got the same error as @kylefiedler

@mhoran
Copy link
Collaborator

mhoran commented Dec 19, 2012

@kylewelsby, @haarts, please try out the latest master, bca84f9. If you continue to experience segfaults, please follow the instructions in #380.

@haarts
Copy link

haarts commented Dec 19, 2012

Rock on. Commenting out font-awesome worked for me. I used http://spin.atomicobject.com/2012/09/05/font-awesome-capybara-webkit/

@kylewelsby
Copy link

My setup now

Gemfile
gem 'capybara' #v2.0.1
gem 'capybara-webkit', :git => 'git://github.com/thoughtbot/capybara-webkit.git' # bca84f9

A few tests pass then,

     Capybara::Driver::Webkit::WebkitNoResponseError:
       No response received from the server.

followed by

     Errno::EPIPE:
       Broken pipe

@mhoran
Copy link
Collaborator

mhoran commented Dec 19, 2012

@kylewelsby, could you open a new issue? It looks like you're experiencing something different than the others, and I don't want to clutter this thread. Please confirm that you are not using font-awesome. Then, please provide output from the failing scenario with the :webkit_debug driver and follow the instructions in #380 for retrieving a backtrace.

@synth
Copy link

synth commented Apr 15, 2013

i might add a possible solution that seems to work for me for the moment. I discovered that there are times after running some specs that fail or crash that there might be lingering(orphaned?) webkit/rspec processes. I continue to get broken pipe while these processes exist even though they're not in the foreground anymore of where I ran them. I use the following command to clear everything out:

ps -ef |egrep 'webkit|rspec' |awk '{print $2}' |xargs kill -9

there's probably a more slick unix command, so feel free to update with a better way...

@nmccready
Copy link

please disregard issue as it is relevant to puma as well

@Dan2552
Copy link

Dan2552 commented Nov 26, 2013

I'm getting this issue on my OS X Mavericks setup. Could this be because homebrew suggested to install QT using --HEAD?

@jeremylynch
Copy link

I had a similar issue as described above that I was able to solve by upgrading Qt

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests