libp2p / libp2p/jvm-libp2p

libp2p connection closed exception...

Open
#452 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
366
Forks
85
Avg merge
2d 39m
Merged PRs (30d)
6

Description

### Summary

Someone using teku was getting this in logs and I think it probably belongs here...

### Expected behavior

can it be more cleanly handled when the connection is unexpectedly closed?

### Actual behavior

```
teku | 2026-03-09 15:05:27.001 INFO - Slot Event *** Slot: 13853725, Block: e77861b402bd9367c8c9d955c9f2e4dcd61c7ccaac282b4297cc199847e8c68f, Justified: 432927, Finalized: 432926, Peers: 80
teku | 2026-03-09 15:05:39.000 INFO - Slot Event *** Slot: 13853726, Block: a9ee9ccd3d359bca29a69309e551a4e1d0c712b0d17ebf36f8c048eca48e839f, Justified: 432927, Finalized: 432926, Peers: 80
teku | 2026-03-09 15:05:46.498 ERROR - PLEASE FIX OR REPORT | Unexpected exception thrown for nioEventLoopGroup-3-22
teku | io.libp2p.core.ConnectionClosedException: The stream was closed for writing locally: a0423ffffe4c0ea0-00000001-001c6097-f8b1ce46912ef7f7-cbd0f5cd/8/false
teku | at io.libp2p.etc.util.netty.mux.MuxChannel.doWrite(MuxChannel.kt:40)
teku | at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:794)
teku | at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:758)
teku | at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1391)
teku | at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:815)
teku | at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1126)
teku | at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:148)
teku | at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:141)
teku | at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:535)
teku | at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:201)
teku | at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1195)
teku | at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
teku | at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
teku | at java.base/java.lang.Thread.run(Unknown Source)
teku | 2026-03-09 15:05:51.161 INFO - Slot Event *** Slot: 13853727, Block: ... empty, Justified: 432927, Finalized: 432926, Peers: 80
teku | 2026-03-09 15:05:59.001 INFO - Epoch Event *** Epoch: 432929, Justified checkpoint: 432928, Finalized checkpoint: 432927, Finalized root: 1b67d0aa685cefcc0166b555943c86a5698afe1619b251f9c9f3d700d0fc6034
teku | 2026-03-09 15:05:59.002 INFO - Sync committee performance: epoch 432928, expected 896, produced 29, correct 29, included 28 (97%)
```

### Relevant log output

```shell

```

### Possible Solution

_No response_

### Version

_No response_

### Would you like to work on fixing this bug ?

No

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at io.libp2p.etc.util.netty.mux.MuxChannel.doWrite in MuxChannel.kt:40, using the reported ConnectionClosedException and Netty stack trace as the entry point. Determine how an unexpected local stream closure should be handled and verify that this scenario no longer produces an unexpected-exception log while preserving normal connection behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.