Skip to content

Commit 8ca8816

Browse files
mitrandir77facebook-github-bot
authored andcommitted
fix the semaphore deadlock
Summary: Somehow before this fix I've seen us runing out of semaphores and deadlocking because not freeing semaphores immediately after finishing running the function requiring git repo. Reviewed By: mojsarn Differential Revision: D31310626 fbshipit-source-id: ba12b2d4918ecc30ca0aa6ff011176f7634badf9
1 parent c380591 commit 8ca8816

File tree

1 file changed

+3
-1
lines changed
  • eden/mononoke/git/git-pool/src

1 file changed

+3
-1
lines changed

eden/mononoke/git/git-pool/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl GitPool {
4444
T: Send + Sync + 'static,
4545
E: Into<Error> + Send + Sync + 'static,
4646
{
47-
let _permit = self.sem.acquire().await?;
47+
let permit = self.sem.clone().acquire_owned().await?;
4848
let pool = self.pool.clone();
4949
let ret = tokio_shim::task::spawn_blocking(move || {
5050
let result_repo = pool.get()?;
@@ -55,6 +55,8 @@ impl GitPool {
5555
}
5656
};
5757
let ret = f(&repo).map_err(|e| e.into())?;
58+
drop(result_repo);
59+
drop(permit);
5860
Result::<_, Error>::Ok(ret)
5961
})
6062
.await??;

0 commit comments

Comments
 (0)