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.
This commit is contained in:
Pauli Virtanen 2026-01-31 16:04:01 +02:00
parent 69d8822303
commit a68a4b0328
2 changed files with 6 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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);
}
}