(UndefinedFunctionError) function Bandit.WebSocket.Socket.close/2 is undefined or private
Closed this issue ยท 3 comments
svsool commented
Hello ๐, thanks for work on this repo!
Noticed the following error on WebSocket close from the client in development environment and config:
[error] GenServer #PID<0.1349.0> terminating
** (UndefinedFunctionError) function Bandit.WebSocket.Socket.close/2 is undefined or private
(bandit 1.5.0) Bandit.WebSocket.Socket.close(%ThousandIsland.Socket{socket: #Port<0.85>, transport_module: ThousandIsland.Transports.TCP, read_timeout: 60000, silent_terminate_on_error: false, span: %ThousandIsland.Telemetry{span_name: :connection, telemetry_span_context: #Reference<0.3827882673.1486094337.210496>, start_time: -576460744752931000, start_metadata: %{parent_telemetry_span_context: #Reference<0.3827882673.1486094337.182234>, remote_address: {127, 0, 0, 1}, remote_port: 52014, telemetry_span_context: #Reference<0.3827882673.1486094337.210496>}}}, 1000)
(bandit 1.5.0) lib/bandit/websocket/connection.ex:236: Bandit.WebSocket.Connection.do_stop/4
(bandit 1.5.0) lib/bandit/websocket/connection.ex:125: Bandit.WebSocket.Connection.handle_control_frame/3
(bandit 1.5.0) lib/bandit/websocket/handler.ex:44: anonymous fn/3 in Bandit.WebSocket.Handler.handle_data/3
(elixir 1.14.0) lib/stream.ex:1742: Stream.do_unfold/4
(elixir 1.14.0) lib/enum.ex:2514: Enum.reduce_while/3
(bandit 1.5.0) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
(bandit 1.5.0) lib/thousand_island/handler.ex:379: Bandit.DelegatingHandler.handle_info/2
(stdlib 4.0.1) gen_server.erl:1120: :gen_server.try_dispatch/4
(stdlib 4.0.1) gen_server.erl:1197: :gen_server.handle_msg/6
(stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:tcp, #Port<0.85>, <<136, 130, 119, 164, 134, 226, 116, 76>>}
config :rtm, Web.Endpoint,
adapter: Bandit.PhoenixAdapter,
# ...
code_reloader: true,
# ...
http: [
thousand_island_options: [
num_acceptors: 10,
num_connections: 50_000,
]
]
code_reloader: true
seems to be an issue, and module reference get messed up somewhere.
No code changes done in between of WebSocket connects, so surprising behavior.
Issue is not present with Cowboy 2 Adapter.
mtrudel commented
This is a curious one! It looks like it's related to the how the Socket protocol gets consolidated in a dev environment. Let me see what I can do about it.
mtrudel commented
If you have a tight repro case that would be very much appreciated
svsool commented
๐ unable to reproduce anymore, closing for now.