我有一个凤凰应用程序,在生产中不断提出多个不同的例外。我正在尝试调查异常,但我不确定我的端点配置是否错误,依赖关系中存在这些错误吗?问题是否与某种程度相关?哪个依赖对他们负责?
我不想打开门票并开始不同项目之间的乒乓对话,所以我想先问一下。
1)
17:58:21.973 [error] Ranch protocol #PID<0.8216.13> (:cowboy_protocol) of listener Krihelinator.Endpoint.HTTP terminated
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in :cowboy_protocol.parse_method/3
(cowboy) src/cowboy_protocol.erl:168: :cowboy_protocol.parse_method("", {:state, #Port<0.19168>, :ranch_tcp, [:cowboy_router, :cowboy_handler], true, [listener: Krihelinator.Endpoint.HTTP, dispatch: [{:_, [], [{["socket", "websocket"], [], Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {Krihelinator.Endpoint, Krihelinator.UserSocket, :websocket}}}, {:_, [], Plug.Adapters.Cowboy.Handler, {Krihelinator.Endpoint, []}}]}]], :undefined, :undefined, 5, 1, 100, 4096, 64, 4096, 100, 5000, 1490810306970}, <<0, 0, 0, 113, 106, 129, 110, 48, 129, 107, 161, 3, 2, 1, 5, 162, 3, 2, 1, 10, 164, 129, 94, 48, 92, 160, 7, 3, 5, 0, 80, 128, 0, 16, 162, 4, 27, 2, 78, 77, 163, 23, 48, 21, 160, 3, 2, 1, 0, 161, ...>>)
2)
2017-04-06 06:21:14.693 [error] Ranch protocol #PID<0.21785.1> (:cowboy_protocol) of listener Krihelinator.Endpoint.HTTP terminated
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in :cowboy_protocol.parse_uri_path/4
(cowboy) src/cowboy_protocol.erl:200: :cowboy_protocol.parse_uri_path("", {:state, #Port<0.6072>, :ranch_tcp, [:cowboy_router, :cowboy_handler], true, [listener: Krihelinator.Endpoint.HTTP, dispatch: [{:_, [], [{["socket", "websocket"], [], Phoenix.Endpoint.CowboyWebSocket, {Phoenix.Transports.WebSocket, {Krihelinator.Endpoint, Krihelinator.UserSocket, :websocket}}}, {:_, [], Plug.Adapters.Cowboy.Handler, {Krihelinator.Endpoint, []}}]}]], :undefined, :undefined, 5, 1, 100, 4096, 64, 4096, 100, 5000, 1491459679639}, <<71, 104, 48, 115, 116, 173, 0, 0, 0, 224, 0, 0, 0, 120, 156, 75, 83, 96, 96, 152, 195, 192, 192, 192, 6, 196, 140, 64, 188, 81, 150, 129, 129, 9, 72, 7, 167, 22, 149, 101, 38, 167, 42, 4, 36, 38, 103, 43, 24, 50, ...>>, <<2, 0, 84, 245, 43, 92>>)
3)
18:20:18.395 [error] Ranch protocol #PID<0.28926.18> (:cowboy_protocol) of listener Krihelinator.Endpoint.HTTP terminated
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in :cow_http_hd.token_ci_list_sep/3
(cowlib) src/cow_http_hd.erl:191: :cow_http_hd.token_ci_list_sep("Te", [], "keep-alive")
(cowlib) src/cow_http_hd.erl:31: :cow_http_hd.parse_connection/1
(cowboy) src/cowboy_req.erl:189: :cowboy_req.new/14
(cowboy) src/cowboy_protocol.erl:410: :cowboy_protocol.request/9
正如您所看到的,我不知道问题发生的原因。所以也许我没有提供足够的信息。如果需要,请要求更多。 任何帮助我修复这些或打开正确项目的门票的指导将非常感激。
答案 0 :(得分:0)
客户端正在发送无效的keepalive标头,牛仔对此非常严格,请参阅https://github.com/ninenines/cowboy/issues/943
如果你知道客户端,你可以要求修复,或者在代理中重写标题,例如HAProxy的
# cowboy crashes when invalid headers are sent
# see https://github.com/ninenines/cowboy/issues/943
acl invalid_keepalive_header hdr(Connection) -i keep-alive\ Te
reqirep ^Connection:\ keep-alive\ Te Connection:\ keep-alive,\ Te if invalid_keepalive_header
acl invalid_keepalive_header_1 hdr(Connection) -i Te\ keep-alive
reqirep ^Connection:\ Te\ keep-alive Connection:\ keep-alive,\ Te if invalid_keepalive_header_1