HashNuke / hound

Elixir library for writing integration tests and browser automation

Home Page:http://hexdocs.pm/hound

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hound make chromedriver crash

Kukunin opened this issue · comments

A simple snippet

      for i <- 1..10 do
        Hound.start_session()
        Hound.end_session()
        Hound.Session.active_sessions() |> Enum.count
      end

it crashes with

	** (Protocol.UndefinedError) protocol Enumerable not implemented for {:error, :closed}. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Scrivener.Page, Stream
	      (elixir) /private/tmp/elixir-20181026-69137-ms45yr/elixir-1.7.4/lib/elixir/lib/enum.ex:1: Enumerable.impl_for!/1
	      (elixir) /private/tmp/elixir-20181026-69137-ms45yr/elixir-1.7.4/lib/elixir/lib/enum.ex:153: Enumerable.count/1
	      (elixir) lib/enum.ex:582: Enum.count/1
	      spec/mr_persistent/browser/polska_spec.exs:50: anonymous fn/2 in Mr.Browser.PolskaSpec.example_has_separate_sessions_sqfbykathncueomlixwvgzpdjr/1
	      (elixir) lib/enum.ex:2967: Enum.reduce_range_inc/4
	      spec/mr_persistent/browser/polska_spec.exs:47: Mr.Browser.PolskaSpec.example_has_separate_sessions_sqfbykathncueomlixwvgzpdjr/1
	      (espec) lib/espec/example_runner.ex:76: ESpec.ExampleRunner.try_run/3
	      (espec) lib/espec/example_runner.ex:43: ESpec.ExampleRunner.run_example/2

because active_sessions() returns {:error, :closed}

crashes the latest chromedriver 2.43 on macOS. Does someone have a similar behavior?
I use the latest hound from master branch.

Log:

[1541452568.237][INFO]: [9b4cf009b6aa25de713958aadfc025fe] RESPONSE InitSession {
   "acceptInsecureCerts": false,
   "acceptSslCerts": false,
   "applicationCacheEnabled": false,
   "browserConnectionEnabled": false,
   "browserName": "chrome",
   "chrome": {
      "chromedriverVersion": "2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052)",
      "userDataDir": "/var/folders/p8/1862yljs6w5g7qq3bcxy4mxw0000gn/T/.org.chromium.Chromium.iDTtDU"
   },
   "cssSelectorsEnabled": true,
   "databaseEnabled": false,
   "goog:chromeOptions": {
      "debuggerAddress": "localhost:52569"
   },
   "handlesAlerts": true,
   "hasTouchScreen": false,
   "javascriptEnabled": true,
   "locationContextEnabled": true,
   "mobileEmulationEnabled": false,
   "nativeEvents": true,
   "networkConnectionEnabled": false,
   "pageLoadStrategy": "normal",
   "platform": "Mac OS X",
   "rotatable": false,
   "~~~": "..."
}
[1541452568.364][INFO]: [9b4cf009b6aa25de713958aadfc025fe] COMMAND Quit {

}
[1541452568.516][INFO]: [9b4cf009b6aa25de713958aadfc025fe] RESPONSE Quit
[1541452568.516][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1541452568.516][DEBUG]: Log type 'browser' lost 0 entries on destruction
Segmentation fault: 11

Does someone have a similar behavior?

I am seeing something similar. In more details, if you do this:

    Hound.start_session(browser: "chrome_headless")
    Hound.end_session()
    Apex.ap Hound.Session.active_sessions()

You will get {:error, :closed} printed, but most importantly, Chromedriver will have crashed:

$ chromedriver
Starting ChromeDriver 2.45.615355 (d5698f682d8b2742017df6c81e0bd8e6a3063189) on port 9515
Only local connections are allowed.
Segmentation fault: 11

So I wonder if this may be an issue in Chromedriver itself, rather than hound.

From my experience, that's chromedriver fault, its pretty unstable on Mac. The same code running on Linux works well. Hound doesn't send something special to chromedriver