Skip to content

Avoid webDriver->quit() on __destruct() when scraping *remote* websites #466

@ThomasLandauer

Description

@ThomasLandauer

When connecting to remote webpages, I'm sometimes getting this exception:

Curl error thrown for http DELETE to /session/5db262bc-961f-4cbf-9983-8d602f00d89a
Operation timed out after 30000 milliseconds with 0 bytes received

And at the bottom of Symfony's exception page:

Curl error thrown for http POST to /session/5db262bc-961f-4cbf-9983-8d602f00d89a/url with params: {"url":"https://www.example.com"}
Operation timed out after 30001 milliseconds with 0 bytes received

As far as I can see, the cause is:
When done, Panther tries to cleanup and Client::quit() calls $this->webDriver->quit();.
And from this I'm guessing:

  • Some servers just respond with 5xx. Possible side effect: After doing this "forbidden" request repeatedly, I might get blocked.
  • Some don't send a response at all. Side effect: Panther waits for 30 seconds (=general timeout), i.e. my command hangs.

So the solution looks pretty clear to me: Don't send that request remotely ;-)

So the first question towards a PR would be: Do you want an automatic check, or rather some user-configurable option to suppress this cleanup?

Related: #169 (don't know if it's really the same, or some Docker-related problem)

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