Skip to content

Commit

Permalink
Catch EINTR in Tutils.wait_for. Fixes: #2861
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Feb 12, 2023
1 parent d85b801 commit 5f7de88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Fixed:
* Fixed shutdown livelock with some ffmpeg inline encoder,
decoder and filter operators.
* Fixed input polling stop (#2769)
* Fixed crash in external processes when received a `Unix.EINTR`
event (#2861)
* Cleaned up srt support.

---
Expand Down
7 changes: 5 additions & 2 deletions src/tools/tutils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,11 @@ let wait_for ?(log = fun _ -> ()) event timeout =
| `Both socket -> ([socket], [socket])
in
let rec wait t =
let l, l', _ = Unix.select r w [] t in
if l = [] && l' = [] then (
let r, w, _ =
try Unix.select r w [] t
with Unix.Unix_error (Unix.EINTR, _, _) -> ([], [], [])
in
if r = [] && w = [] then (
let current_time = Unix.gettimeofday () in
if current_time >= max_time then (
log "Timeout reached!";
Expand Down

0 comments on commit 5f7de88

Please sign in to comment.