testcontainers-go
testcontainers-go copied to clipboard
fix: fix log producer stopping block indefinitely
Fixes an issue where stopping the log producer would block indefinitely if the log producer has exited before.
What does this PR do?
Fixes stopping the log producer blocking by not requiring a read on the stopProducer channel but simply closing it.
There is no synchronization for the log producer to finish running anyways, so this should be fine.
Why is it important?
If the log producer exits due to an exited container, StopLogProducer will hang indefinitely.
Related issues
Closes #1407 Closes #1669
How to test this PR
Test has been added.
Follow-ups
stopProducer is currently not safe for concurrent use. Maybe add some synchronization in the future.
Deploy Preview for testcontainers-go ready!
| Name | Link |
|---|---|
| Latest commit | ca049655293fd1cfe50dc66c9564abd53a1b0147 |
| Latest deploy log | https://app.netlify.com/sites/testcontainers-go/deploys/654abe763e9b53000818d968 |
| Deploy Preview | https://deploy-preview-1783--testcontainers-go.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
Hey @lefinal thanks for this! Do you think it is related to https://github.com/testcontainers/testcontainers-go/pull/1777?
Hey @lefinal thanks for this! Do you think it is related to #1777?
The mentioned issue regarding panics is not the same. However, the changes from #1777 will accomplish the same thing. The author just uses context.Context and context.CancelFunc instead of closing the channel. Both approaches will avoid StopLogProducer hanging.
Hey @lefinal thanks for this! Do you think it is related to #1777?
The mentioned issue regarding panics is not the same. However, the changes from #1777 will accomplish the same thing. The author just uses
context.Contextandcontext.CancelFuncinstead of closing the channel. Both approaches will avoidStopLogProducerhanging.
So, if you mind 🙏 , once we merge that one (already reviewed, tested and commented by the community), we can close this one.
Hey @lefinal thanks for this! Do you think it is related to #1777?
The mentioned issue regarding panics is not the same. However, the changes from #1777 will accomplish the same thing. The author just uses
context.Contextandcontext.CancelFuncinstead of closing the channel. Both approaches will avoidStopLogProducerhanging.So, if you mind 🙏 , once we merge that one (already reviewed, tested and commented by the community), we can close this one.
Absolutely! Only wanted to provide a quick fix in case #1777 takes longer to review and merge :)
Only wanted to provide a quick fix in case #1777 takes longer to review and merge
Would you mind resolving the conflicts if possible? 🙏 I think this fix if easier to merge that #1777
Only wanted to provide a quick fix in case #1777 takes longer to review and merge
Would you mind resolving the conflicts if possible? 🙏 I think this fix if easier to merge that #1777
Done :)
Any updates on this?
I think https://github.com/testcontainers/testcontainers-go/pull/1971 could be related to this
@lefinal is #1971 superseding this one? Could you please verify that? 🙏
Hey @lefinal did you check https://github.com/testcontainers/testcontainers-go/pull/1783#issuecomment-1944534360?
Please let me know if I can close this one 🙏
Cheers!