logs.go: fixed logger creation
Previously, the done channel was not closed properly in case of an error returned by logPipe.Close(), potentially leading to a goroutine leak. This commit ensures that the done channel is closed even if there's an error during the closing of logPipe.
the done channel was not closed properly in case of an error returned by logPipe.Close()
I think we have catched the error returned by logPipe.Close(), so I think the done channel will be closed in any case.
https://github.com/opencontainers/runc/blob/71524dcff4f824772f6b64df6b29a7903ac0781d/libcontainer/logs/logs.go#L30-L32
Yes, but I think it will be better to move it to defer func. Thanks.
the done channel was not closed properly in case of an error returned by logPipe.Close()
I think we have catched the error returned by
logPipe.Close(), so I think the done channel will be closed in any case.https://github.com/opencontainers/runc/blob/71524dcff4f824772f6b64df6b29a7903ac0781d/libcontainer/logs/logs.go#L30-L32
Hmm you are right (not sure how I overlooked it).
So, while defer is indeed better, there's nothing to fix here. For this reason, I'd rather not merge this.
@AntonMoryakov can you comment on https://github.com/opencontainers/runc/pull/4254#issuecomment-2078454118?
Closing for now; will reopen depending on the PR author response.