holsee / chroxy

Headless Chrome as a Service

Home Page:https://hex.pm/packages/chroxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Address is use

holsee opened this issue · comments

When performing basic stress testing the following error occurs:

10:27:31.339 request_id=Ff2tuFY7vDKkyNYAAEki pid=<0.2931.0> module=Plug.Logger [info]  Sent 200 in 202ms

10:27:31.340 pid=<0.2627.0> module=gen_server [error] GenServer Chroxy.ProxyListener terminating
** (CaseClauseError) no case clause matching: {:error, :emfile}
    (chroxy 0.6.3) lib/chroxy/proxy_listener.ex:85: Chroxy.ProxyListener.handle_cast/2
    (stdlib 3.9) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.9) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.9) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:accept, [dyn_hook: #Function<0.68892742/1 in Chroxy.ChromeProxy.handle_call/3>]}}
State: %{listen_socket: #Port<0.1125>}

10:27:31.340 pid=<0.2933.0> module=Plug.Logger [info]  GET /api/v1/connection

10:27:31.341 pid=<0.2935.0> module=Chroxy.ProxyListener [error] TCP Listen failed due to: :eaddrinuse

When the Chroxy.ProxyListener fails to obtain address to bind to, within a race condition between the restart of the tcp listener and the clean-up of the native resource after the crash, then the system will enter a bad state where Chrome page sessions will be created as part of the http request for a page session to chroxy, but the websocket proxy will not be able to be created.