From a68a4b0328977686c4fa70d91f1f09b816bb7d5c Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 31 Jan 2026 16:04:01 +0200 Subject: [PATCH] stream: on EPROTO core error, set streams & filters to error state If core emits EPROTO error, there is some protocol error with server communication that may not be recoverable (eg. ran out of fds) and previous operations may not have completed correctly. When it occurs, transition all streams & filters using the connection to error state, as they may not be in valid state. E.g. if pipewire-pulse is told to PLAY_SAMPLE many samples at the same time, this error occurs and sample-play.c streams never enter STREAMING, never releasing the fds they allocated and the server hits the max fd limit. --- src/pipewire/filter.c | 3 +++ src/pipewire/stream.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index bb23c9d5c..a5b98f5b7 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -1159,6 +1159,9 @@ static void on_core_error(void *_data, uint32_t id, int seq, int res, const char if (id == PW_ID_CORE && res == -EPIPE) { filter_set_state(filter, PW_FILTER_STATE_UNCONNECTED, res, message); + } else if (id == PW_ID_CORE && res == -EPROTO) { + pw_filter_set_active(filter, false); + filter_set_state(filter, PW_FILTER_STATE_ERROR, res, message); } } diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 477861f61..7b4102c5d 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1508,6 +1508,9 @@ static void on_core_error(void *data, uint32_t id, int seq, int res, const char if (id == PW_ID_CORE && res == -EPIPE) { stream_set_state(stream, PW_STREAM_STATE_UNCONNECTED, res, message); + } else if (id == PW_ID_CORE && res == -EPROTO) { + pw_stream_set_active(stream, false); + stream_set_state(stream, PW_STREAM_STATE_ERROR, res, message); } }