diff options
author | Sanchayan Maity <sanchayan@asymptotic.io> | 2023-02-03 14:30:57 +0300 |
---|---|---|
committer | Sanchayan Maity <sanchayan@asymptotic.io> | 2023-02-03 16:39:18 +0300 |
commit | 6006a0ba3639c95e6a38ce10d7bae03b14f0beb5 (patch) | |
tree | 7e1ae43995ebf3477380f2d753332fed484e87b4 /net/aws | |
parent | 41aa1e51da6a30118eff1a15ddf28cf7590fbc07 (diff) |
aws/s3hlssink: Fix deadlock on EOS
In state change to NULL, we take state lock and call stop. When stop
is called, we will try to upload queued segments in S3 request thread.
That tries to take the state lock again and deadlocks.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1076>
Diffstat (limited to 'net/aws')
-rw-r--r-- | net/aws/src/s3hlssink/imp.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/aws/src/s3hlssink/imp.rs b/net/aws/src/s3hlssink/imp.rs index 7c90087a..4d079188 100644 --- a/net/aws/src/s3hlssink/imp.rs +++ b/net/aws/src/s3hlssink/imp.rs @@ -408,6 +408,9 @@ impl S3HlsSink { } }; }; + + let mut state = self.state.lock().unwrap(); + *state = State::Stopped } fn create_stats(&self) -> gst::Structure { @@ -649,6 +652,7 @@ impl ObjectImpl for S3HlsSink { State::Started(ref mut state) => state.num_uploads_started += 1, State::Stopped => unreachable!("State not started yet"), }; + drop(state); let s3_location = args[1].get::<&str>().unwrap(); let upload = S3Upload::new( @@ -683,6 +687,7 @@ impl ObjectImpl for S3HlsSink { State::Started(ref mut state) => state.num_uploads_started += 1, State::Stopped => unreachable!("State not started yet"), }; + drop(state); let s3_location = args[1].get::<&str>().unwrap(); let upload = S3Upload::new( @@ -808,10 +813,12 @@ impl ElementImpl for S3HlsSink { * in turn will require the settings lock. */ let settings = self.settings.lock().unwrap(); - let mut state = self.state.lock().unwrap(); match transition { - gst::StateChange::ReadyToPaused => *state = State::Started(Started::default()), + gst::StateChange::ReadyToPaused => { + let mut state = self.state.lock().unwrap(); + *state = State::Started(Started::default()); + } gst::StateChange::PausedToPlaying => { let s3_txc = settings.s3_txc.clone(); if let Some(tx) = s3_txc { @@ -849,8 +856,6 @@ impl ElementImpl for S3HlsSink { * pending requests. */ self.stop(); - - *state = State::Stopped } _ => (), } |