CaliDog/certstream-server

/stats endpoint broken

Opened this issue · 1 comments

Synse commented

The /stats endpoint is currently returning an HTTP 500 error. The following error is logged to the console when this happens:

19:10:46.014 [error] Ranch listener :websocket_server, connection process #PID<0.5364.0>, stream 4 had its request process #PID<0.5399.0> exit with reason :function_clause and stacktrace [{Access, :get, [:ok, :url, nil], []}, {Certstream.WebsocketServer, :"-init/2-fun-0-", 2, [file: 'lib/web.ex', line: 39]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: 'lib/enum.ex', line: 2111]}, {Certstream.WebsocketServer, :init, 2, [file: 'lib/web.ex', line: 37]}, {:cowboy_handler, :execute, 2, [file: '/home/codespace/workspace/certstream-server/deps/cowboy/src/cowboy_handler.erl', line: 37]}, {:cowboy_stream_h, :execute, 3, [file: '/home/codespace/workspace/certstream-server/deps/cowboy/src/cowboy_stream_h.erl', line: 300]}, {:cowboy_stream_h, :request_process, 3, [file: '/home/codespace/workspace/certstream-server/deps/cowboy/src/cowboy_stream_h.erl', line: 291]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 226]}]

After looking at the code for a bit I believe there are two issues here.

  • :sys.get_state can timeout
  • state is :ok for any workers that failed to start completely

Hey @Synse, yeah I had no idea that :sys.get_state could timeout, but under load it definitely does which causes issues. I'm going to be cleaning some stuff up so I'll try to get to this as well!

Thanks for the bug report!