Fix deadlock when closing pipe - #324
Conversation
90fdf20 to
70746b4
Compare
70746b4 to
252d76a
Compare
|
Mathieu Champlon (@mat007) I think this PR fixes #257, correct? If so, can you add a |
I don’t know if it fixes that one, I was investigating something else. I’m really not sure it’s related. 🤔 |
|
Oh, sorry; someone pointed me to that ticket as the reason for maintaining a fork, so I thought this PR was related to that |
|
Mathieu Champlon (@mat007) can you explain what the deadlock is that you're seeing? |
Sure! The added test without the fix never terminates. Breaking under a debugger we see that the goroutine that called Line 578 in bdc6c11 ListenPipe one is waiting on Lines 462 to 463 in bdc6c11 The problem is that we have 2 readers for Line 447 in bdc6c11 This PR fixes this by closing the channel instead of writing to it. |
|
Kevin Parsons (@kevpar) what do you think of my explanation? Do you need more info? |
Sorry, I just got back from holiday. I will take a look today and see if we can get this in! |
|
I've been doing some testing/thinking on this. Overall I think it looks good, just have a few pieces of feedback.
Thanks! |
|
Also, looks like there are some CI failures. |
|
Had a quick peek; linting errors look unrelated to the PR; The go-generate one is more interesting, as there's a panic; I see 070c828 changed CI to not used fixed versions of Go, and |
|
Opened a PR for those linting issues; (not sure about the panic, because I'm not on Windows, so maybe it was just a incident; we'll see on the other PR) |
Thanks! I’ll look into addressing these. |
0428472 to
9d32dd6
Compare
|
Kevin Parsons (@kevpar) can you please take another look? |
Changes look good, thanks! One thing that just occurred to me -- there is a chance of a panic if two goroutines try to close a listener at the same time (such that they both try to close |
50b28d0 to
71048cd
Compare
Good catch! This makes the implementation of Close much simpler as well. |
Kevin Parsons (kevpar)
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the change :)
|
Kevin Parsons (@kevpar) here is a PR to fix the panic with go generate: #326 |
|
Kevin Parsons (@kevpar) We've also been running into this issue quite often as well, mostly in CI (feels like a quarter of the builds fail at least once because of this). Would it be possible to get a release out with the 3 changes from Mathieu Champlon (@mat007) (this one, #325 and #326). |
|
Kevin Parsons (@kevpar) Hamza El-Saawy (@helsaawy) Kirtana Ashok (@kiashok) what can I do to help move this fix forward? |
|
Kevin Parsons (@kevpar) Hamza El-Saawy (@helsaawy) Kirtana Ashok (@kiashok), pinging again here. We'd really like to have a new release with this fix merged in, it's causing our CI to break very frequently. Are there any plans to look into this PR some more? Or maybe more importantly, is the library still maintained? |
|
Kirtana Ashok (@kiashok) sorry for pinging you again. |
|
Hamza El-Saawy (@helsaawy), Amit Barve (@ambarve) I see that the linting issues were fixed in #334, maybe all that these needs now is to rebase it on top of main? |
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
200 was a little low to consistently trigger the issue. Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
This should help tell when we are deadlocking from test logs if we hit a problem in the future. Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
Signed-off-by: Mathieu Champlon <mathieu.champlon@docker.com>
71048cd to
1c8e60a
Compare
|
I’ve rebased the PR, can someone approve the workflow runs? |
Hi!
This PR fixes a deadlock that we face every once in a while.
Thanks!