Ask questionspotential goroutine leak caused by recv deadlock

<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.

If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.

For more information about reporting issues, see


The GitHub issue tracker is for bug reports and feature requests. General support for docker can be found at the following locations:

  • Docker Support Forums -
  • Slack - #general channel
  • Post a question on StackOverflow, using the Docker tag

General support for moby can be found at the following locations:

  • Moby Project Forums -
  • Slack - #moby-project channel
  • Post a question on StackOverflow, using the Moby tag


Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->


<!-- Briefly describe the problem you are having in a few paragraphs. --> A infinite-loop with select has potential to be blocked at channel recv operation, which will cause a goroutine leak.

Steps to reproduce the issue: In TestCollectBatchMultilinePattern,a new goroutine been created Above loop will keep running and calling l.publishBatch

l.putLogEvents will be called


Since it is in test, the mock client is given. However, in test TestCollectBatchMultilinePattern, there is no action to close m.putLogEventsResult or notify PutLogEvents, so output := <-m.putLogEventsResult will be blocked. This will cause the goroutine created by go stream.collectBatch(d) deadlock.

Describe the results you received: A goroutine leak caused by blocked channel recv.

Describe the results you expected: Proper release goroutine.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

(paste your output here)

Output of docker info:

(paste your output here)

Additional environment details (AWS, VirtualBox, physical, etc.):


Answer questions system-pclub

Only one message is sent to mockClient.putLogEventsResult in TestCollectBatchMultilinePattern() (

If the loop in function collectBatch() ( chooses ticker.C more than once, function PutLogEvents() ( will be called more than once.

At this time, the receiving operation on m.putLogEventsResult in function PutLogEvents() will block the child goroutine created by "go stream.collectBatch()" in TestCollectBatchMultilinePattern() forever.

Basically, a deadlock is triggered.

Github User Rank List