Skip to content

SIGSEGV when using password with server_awaiting_accept mode #1100

@mjurincic

Description

@mjurincic

We're using ex_libsrt v0.1.6 with membrane_srt_plugin v0.1.1 to build a multi-stream SRT ingest server. We share a single ExLibSRT.Server across multiple streams using the server_awaiting_accept pattern from the docs.

Everything works great without a password. But as soon as we pass a passphrase to Server.start_link/3, the BEAM crashes with a SIGSEGV (exit code 139) when a client connects and we accept the connection.

How to reproduce

Start the server with a password:

{:ok, server} = ExLibSRT.Server.start_link("0.0.0.0", 9000, "devpassphrase1234")

Then wait for a connection and accept it:

receive do
  {:srt_server_connect_request, _address, _stream_id} ->
    :ok = ExLibSRT.Server.accept_awaiting_connect_request(server)
end

Connect with GStreamer using the matching passphrase:

gst-launch-1.0 -e \
  videotestsrc is-live=true ! x264enc tune=zerolatency ! mpegtsmux ! \
  srtsink uri="srt://127.0.0.1:9000?streamid=test&passphrase=devpassphrase1234&pbkeylen=16" \
  wait-for-connection=true

BEAM dies immediately. No Elixir error, no crash log — just gone. Exit code 139.

What I think is happening

Looking at server.cpp, OnNewConnection() sets SRTO_PASSPHRASE on the socket inside srt_listen_callback, then blocks on a condition variable for up to 1 second waiting for the Elixir side to accept. My guess is the blocking callback messes with libsrt's crypto handshake state — the key exchange needs back-and-forth that can't happen while the callback is stuck waiting.

Without a password the same blocking-accept flow works fine, so it's specifically the combination of password + the deferred accept pattern.

Environment

  • ex_libsrt v0.1.6, membrane_srt_plugin v0.1.1
  • Elixir 1.19.5 / OTP 27
  • macOS 15.5 arm64

Workaround

We disabled the passphrase for now and rely on network-level security.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions