<p dir="auto">Unit tests on our CI have apparently been failing for 2 weeks and no one noticed (oops!)...</p>
<p dir="auto">The PR that seems to have caused the failures is <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="107627860" data-permission-text="Title is private" data-url="https://github.com/kubernetes/kubernetes/issues/14328" data-hovercard-type="pull_request" data-hovercard-url="/kubernetes/kubernetes/pull/14328/hovercard" href="https://github.com/kubernetes/kubernetes/pull/14328">#14328</a>.</p>
<p dir="auto">The failing test is <code class="notranslate">k8s.io/kubernetes/pkg/volume/flocker</code> - <code class="notranslate">TestSetUpAtInternal</code>.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[16:15:04][Step 4/5] --- FAIL: TestSetUpAtInternal (0.00s)
[16:15:04][Step 4/5]    assertions.go:202: 
[16:15:04][Step 4/5]                         
[16:15:04][Step 4/5]    Error Trace:    plugin_test.go:208
[16:15:04][Step 4/5]        
[16:15:04][Step 4/5]    Error:      Not equal: &quot;expected-to-be-set-properly&quot; (expected)
[16:15:04][Step 4/5]                    != &quot;&quot; (actual)
[16:15:04][Step 4/5]        
[16:15:04][Step 4/5] FAIL
[16:15:04][Step 4/5] FAIL   k8s.io/kubernetes/pkg/volume/flocker    0.014s"><pre class="notranslate"><code class="notranslate">[16:15:04][Step 4/5] --- FAIL: TestSetUpAtInternal (0.00s)
[16:15:04][Step 4/5]    assertions.go:202: 
[16:15:04][Step 4/5]                         
[16:15:04][Step 4/5]    Error Trace:    plugin_test.go:208
[16:15:04][Step 4/5]        
[16:15:04][Step 4/5]    Error:      Not equal: "expected-to-be-set-properly" (expected)
[16:15:04][Step 4/5]                    != "" (actual)
[16:15:04][Step 4/5]        
[16:15:04][Step 4/5] FAIL
[16:15:04][Step 4/5] FAIL   k8s.io/kubernetes/pkg/volume/flocker    0.014s
</code></pre></div>
<p dir="auto">Full Test Log: <a href="https://teamcity.mesosphere.io/viewLog.html?buildId=54217&amp;buildTypeId=Oss_KubernetesMesos_2UnitTests&amp;tab=buildLog&amp;guest=1#_focus=866" rel="nofollow">https://teamcity.mesosphere.io/viewLog.html?buildId=54217&amp;buildTypeId=Oss_KubernetesMesos_2UnitTests&amp;tab=buildLog&amp;guest=1#_focus=866</a></p>
<p dir="auto">I'm not sure why this is failing on our CI and not on shippable. Has anyone else seen something similar?</p>
<p dir="auto"><strong>That test only seems to fail on the second run through with <code class="notranslate">etcdPrefix: kubernetes.io/registry</code>.</strong></p>
<p dir="auto">Our unit tests run in a container built specifically for testing k8s-mesos:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cluster/mesos/docker/test/build.sh
$ docker run --rm \
  -v &quot;$(pwd):/go/src/github.com/GoogleCloudPlatform/kubernetes&quot; \
  -v &quot;/var/run/docker.sock:/var/run/docker.sock&quot; \
  mesosphere/kubernetes-mesos-test \
  -cexu &quot;\
    cd /go/src/github.com/GoogleCloudPlatform/kubernetes &amp;&amp; \
    make clean &amp;&amp; \
    export KUBERNETES_CONTRIB=mesos &amp;&amp; \
    make test
  &quot;"><pre class="notranslate"><code class="notranslate">$ cluster/mesos/docker/test/build.sh
$ docker run --rm \
  -v "$(pwd):/go/src/github.com/GoogleCloudPlatform/kubernetes" \
  -v "/var/run/docker.sock:/var/run/docker.sock" \
  mesosphere/kubernetes-mesos-test \
  -cexu "\
    cd /go/src/github.com/GoogleCloudPlatform/kubernetes &amp;&amp; \
    make clean &amp;&amp; \
    export KUBERNETES_CONTRIB=mesos &amp;&amp; \
    make test
  "
</code></pre></div>
<p dir="auto">The Dockerfile for the env: <a href="https://github.com/kubernetes/kubernetes/blob/master/cluster/mesos/docker/test/Dockerfile">https://github.com/kubernetes/kubernetes/blob/master/cluster/mesos/docker/test/Dockerfile</a></p>
<p dir="auto">Is anyone else able to repro with the above env or their own?</p>
<p dir="auto"><strong>Is this a request for help?</strong> (If yes, you should use our troubleshooting guide and community support channels, see <a href="http://kubernetes.io/docs/troubleshooting/" rel="nofollow">http://kubernetes.io/docs/troubleshooting/</a>.): No</p>
<p dir="auto"><strong>What keywords did you search in Kubernetes issues before filing this one?</strong> (If you have found any duplicates, you should instead reply there.): close channel multiple times</p>
<hr>
<p dir="auto"><strong>Is this a BUG REPORT or FEATURE REQUEST?</strong> (choose one): BUG REPORT</p>

<p dir="auto"><strong>Kubernetes version</strong> (use <code class="notranslate">kubectl version</code>): master</p>
<p dir="auto"><strong>Environment</strong>: None</p>
<ul dir="auto">
<li><strong>Cloud provider or hardware configuration</strong>: None</li>
<li><strong>OS</strong> (e.g. from /etc/os-release): None</li>
<li><strong>Kernel</strong> (e.g. <code class="notranslate">uname -a</code>): None</li>
<li><strong>Install tools</strong>: None</li>
<li><strong>Others</strong>: None</li>
</ul>
<p dir="auto"><strong>What happened</strong>:<br>
Panic maybe happens, since close the same channel multiple times.</p>
<p dir="auto"><strong>What you expected to happen</strong>:</p>
<p dir="auto"><strong>How to reproduce it</strong> (as minimally and precisely as possible):</p>
<p dir="auto"><strong>Anything else do we need to know</strong>:</p>
<p dir="auto">in the file pkg/proxy/config/config.go:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func (c *ServiceConfig) Channel(source string) chan ServiceUpdate {
	ch := c.mux.Channel(source)
	serviceCh := make(chan ServiceUpdate)
	go func() {
		for update := range serviceCh {
			ch &lt;- update
		}
		close(ch)
	}()
	return serviceCh
}"><pre class="notranslate"><code class="notranslate">func (c *ServiceConfig) Channel(source string) chan ServiceUpdate {
	ch := c.mux.Channel(source)
	serviceCh := make(chan ServiceUpdate)
	go func() {
		for update := range serviceCh {
			ch &lt;- update
		}
		close(ch)
	}()
	return serviceCh
}
</code></pre></div>
<p dir="auto">The function Channel is allowed to be invoked many times with the same source,<br>
for example,<br>
c.Channel("one")<br>
...<br>
c.Channel("one"),<br>
then, it creates only one channel ch, that is, c.mux.sources["one"], while close(ch) will be invoked many times.</p>
<p dir="auto">So I think it is a bug, although the close(ch) may not be run for ever.</p>
<p dir="auto">I think discard the code "close(ch)" will be better.</p>