# ClosedChannelException during recordCoverage step; out of memory?

**URL:** <https://community.jenkins.io/t/closedchannelexception-during-recordcoverage-step-out-of-memory/26074>\
**Category:** Ask a question\
**Tags:** code-coverage\
**Created:** [January 23, 2025, 2:15pm UTC](https://community.jenkins.io/t/closedchannelexception-during-recordcoverage-step-out-of-memory/26074 "2025-01-23T14:15:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kon](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/kon/32/1197_2.png) [@kon](https://community.jenkins.io/u/kon)\
**Post date:** [January 23, 2025, 2:15pm UTC](https://community.jenkins.io/t/closedchannelexception-during-recordcoverage-step-out-of-memory/26074/1 "2025-01-23T14:15:51Z")

</div>

I am trying to make Jenkins show code coverage measurements for tests of .NET code on Windows. I have configured the test projects so that coverage files are generated when the Jenkins agent runs the tests. The pipeline then runs the `recordCoverage` step like this:

```groovy
                recordCoverage(
                    checksAnnotationScope: 'ALL_LINES',
                    ignoreParsingErrors: true,
                    sourceCodeRetention: 'NEVER',
                    tools: [[parser: 'COBERTURA', pattern: 'Test/TestResults/**/coverage.cobertura.xml']])

```

However, the step fails with a ClosedChannelException:

```auto
hudson.remoting.ProxyException: java.nio.channels.ClosedChannelException
 Also: hudson.remoting.ProxyException: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from [REDACTED]
 		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1923)
 		at hudson.remoting.Request.call(Request.java:204)
 		at hudson.remoting.Channel.call(Channel.java:1111)
 		at hudson.FilePath.act(FilePath.java:1228)
 		at hudson.FilePath.act(FilePath.java:1217)
 		at PluginClassLoader for coverage//io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.recordCoverageResults(CoverageRecorder.java:492)
 		at PluginClassLoader for coverage//io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:416)
 		at PluginClassLoader for coverage//io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.perform(CoverageRecorder.java:406)
 		at PluginClassLoader for coverage//io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:365)
 		at PluginClassLoader for coverage//io.jenkins.plugins.coverage.metrics.steps.CoverageStep$Execution.run(CoverageStep.java:333)
 		at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
 		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
 		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
 Also: hudson.remoting.ProxyException: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 4c445e43-4839-434d-98b3-c024d78ed5cb
 Caused: hudson.remoting.ProxyException: hudson.remoting.RequestAbortedException: java.nio.channels.ClosedChannelException
 	at hudson.remoting.Request.abort(Request.java:358)
 	at hudson.remoting.Channel.terminate(Channel.java:1196)
 	at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:241)
 	at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecvClosed(ApplicationLayer.java:221)
 	at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:824)
 	at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:289)
 	at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:167)
 	at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:824)
 	at org.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:155)
 	at org.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:196)
 	at org.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:804)
 	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
 	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
 	at jenkins.util.ErrorLoggingExecutorService.lambda$wrap$0(ErrorLoggingExecutorService.java:51)
 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
 	at java.base/java.lang.Thread.run(Thread.java:840)

```

I suspect the Jenkins agent runs out of memory and closes the channel because of that. How can I verify this hypothesis? I have not found the exception from any log files of the agent.

The Jenkins agent runs Remoting 3261.v9c670a\_4748a\_9 on Eclipse Temurin 17.0 on Windows. The controller has Coverage Plugin 1.16.1 and Jenkins 2.479.3.

“io.jenkins.plugins.coverage.metrics.steps.CoverageRecorder.recordCoverageResults(CoverageRecorder.java:492)” referenced in the stack trace is here:

[https://github.com/jenkinsci/coverage-plugin/blob/7a0777acc3436db0b843334ed4ecfc5cddef2b48/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java#L492-L494](https://github.com/jenkinsci/coverage-plugin/blob/7a0777acc3436db0b843334ed4ecfc5cddef2b48/plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/CoverageRecorder.java#L492-L494)

So it creates a CoverageReportScanner instance and I guess that then runs in the agent process.
