Workaround for Wallaby HTTPoison error

I am getting the error listed here https://github.com/elixir-wallaby/wallaby/issues/365 reliably ~50% of the time.

Anyone here have a workaround that may not have been discussed in this thread?

Thank you

Update:

Making async false and adding a sleep (~200ms) around every click/visit doesn’t make a difference. Tests passing < 50% of time with the same error:

(RuntimeError) Wallaby had an internal issue with HTTPoison:
     %HTTPoison.Error{id: nil, reason: :timeout}

@woohaaha Can you paste more of the stacktrace? This doesn’t say where the error happens.

But we at least see that you’re hitting timeouts. Maybe try increasing them? Docs here: https://hexdocs.pm/wallaby/readme.html#adjusting-timeouts

And if you’re running many tests in parallel, maybe try tuning that down as well? It is possible that the machine or Chromedriver can’t keep up.

Thank you for the suggestions!

I will paste the output of the error when I run it later.

I’ll checkout the timeouts suggestion and also explore other settings which I think are here https://github.com/benoitc/hackney/blob/master/doc/hackney.md under “make a request”

And if you’re running many tests in parallel, maybe try tuning that down as well?

How do I turn those down? I cannot find anything about allowing only one session to run.

It is possible that the machine or Chromedriver can’t keep up

Anything is possible :grinning: If I had to guess, and per the discussions in the github thread, it is that the chromedriver cannot keep up. I think my machine is fine since it is fairly new (2017) and I have turned off all memory hungry applications while testing to be sure. Upgraded to ChromeDriver 80.0.3987.16 (and browser as well). Are there any configs I can and should pass to it?

You can do that either in ExUnit’s config: https://hexdocs.pm/ex_unit/ExUnit.html#configure/1 or when running mix test: https://hexdocs.pm/mix/Mix.Tasks.Test.html#module-command-line-options (look for max_cases/max-cases)

had this error
" test login --core test (Devato.Features.IndexPageTest)
test/devato_web/features/index_page_test.exs:13
** (RuntimeError) Wallaby had an internal issue with HTTPoison:
%HTTPoison.Error{id: nil, reason: :timeout}
stacktrace:
(wallaby 0.23.0) lib/wallaby/httpclient.ex:37: Wallaby.HTTPClient.make_request/5
(wallaby 0.23.0) lib/wallaby/experimental/chrome.ex:96: Wallaby.Experimental.Chrome.start_session/1
(wallaby 0.23.0) lib/wallaby.ex:78: Wallaby.start_session/1
(devato 0.1.0) test/support/feature_case.ex:25: Devato.FeatureCase.__ex_unit_setup_0/1
(devato 0.1.0) test/support/feature_case.ex:1: Devato.FeatureCase.ex_unit/2
test/devato_web/features/index_page_test.exs:1: Devato.Features.IndexPageTest.ex_unit/2"

i could run the tests chrome headless but i needed it to work so i can see it running on the browser . What worked for me was configuring the timeouts

https://hexdocs.pm/wallaby/0.23.0/readme.html#config
added
config :wallaby,
hackney_options: [timeout: :infinity, recv_timeout: :infinity]

Overriding a value

config :wallaby,
hackney_options: [timeout: 5_000]

hope this helps others

1 Like