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

Capybara webkit crash on preflight CORS request failure #1055

@AlanFoster

Description

@AlanFoster

When a preflight CORS request fails, capybara webkit crashes:

Capybara::Webkit::CrashError:
    The webkit_server process crashed!

     Connection reset by peer

    This is a bug in capybara-webkit. For help with this crash, please visit:

    https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes

If it helps, this is the preflight options check that appears to kill webkit:

curl -v -X OPTIONS  --insecure https://api.github.com
* Rebuilt URL to: https://api.github.com/
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connection failed
* connect to 127.0.0.1 port 49153 failed: Connection refused
* Failed to connect to localhost port 49153: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 49153: Connection refused

Example

I have made the following project as an example:

git clone -b webkit-crashes-with-preflight-failure [email protected]:AlanFoster/rspec-capybara-feature-testing.git
cd rspec-capybara-feature-testing/website
bundle

Running the following command will cause webkit to crash 100% of the time:

$ FORCE_WEBKIT_CRASH=true DEBUG=true rspec ./spec/features/javascript_spec.rb
> ...
     Failure/Error: expect(page).to have_content('Successfully retrieved server response')

     Capybara::Webkit::CrashError:
       The webkit_server process crashed!

         Broken pipe

       This is a bug in capybara-webkit. For help with this crash, please visit:

       https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes

Whilst correctly stubbing the preflight CORS request will not crash webkit:

DEBUG=true rspec ./spec/features/javascript_spec.rb
...

Finished in 2.15 seconds (files took 1.91 seconds to load)
1 example, 0 failures

Context: I am using puffing billy to stub requests made during feature tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions