Skip to content

Handle empty client_handler#110

Merged
varsill merged 2 commits intomembraneframework:masterfrom
olegokunevych:client_handler_nil
Mar 19, 2025
Merged

Handle empty client_handler#110
varsill merged 2 commits intomembraneframework:masterfrom
olegokunevych:client_handler_nil

Conversation

@olegokunevych
Copy link
Contributor

@olegokunevych olegokunevych commented Mar 18, 2025

We are using membrane_rtmp_plugin lib as part of our pipeline. Occasionally, once or twice a day plugin crashes with the following error:

UndefinedFunctionError: function nil.handle_connection_closed/1 is undefined
  ?, in nil.handle_connection_closed/1
  File "lib/membrane_rtmp_plugin/rtmp_server/client_handler.ex", line 238, in Membrane.RTMPServer.ClientHandler.handle_event/2
  File "lib/enum.ex", line 2546, in Enum."-reduce/3-lists^foldl/2-0-"/3
  File "lib/membrane_rtmp_plugin/rtmp_server/client_handler.ex", line 118, in Membrane.RTMPServer.ClientHandler.handle_info/2
  File "gen_server.erl", line 1095, in :gen_server.try_handle_info/3
  File "gen_server.erl", line 1183, in :gen_server.handle_msg/6
  File "proc_lib.erl", line 241, in :proc_lib.init_p_do_apply/3

I've been able to reproduce it locally, and this error happens even without any RTMP connections. @varsill could you take a closer look and find out if this fix makes sense?

@olegokunevych olegokunevych requested a review from varsill as a code owner March 18, 2025 15:34
@varsill
Copy link
Contributor

varsill commented Mar 19, 2025

Hi @olegokunevych !
Thank you very much for the contribution!
It turns out that the socket was getting closed before the handler had been created (creating handler requires parsing some RTMP messages).

@varsill varsill merged commit 70c67cd into membraneframework:master Mar 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants