-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Enabling WSS/TLS for SocketIO connections triggers a fatal buffer error:
ERROR com.socketio4j.socketio.listener.DefaultExceptionListener - refCnt: 0
io.netty.util.IllegalReferenceCountException: refCnt: 0
I had this issue originally here:
mrniko/netty-socketio#1062
while that was solved using the exact needed netty version I am now unable to find a working version.
TLS should be OK because connection are established to endpoint wss://myserver:8085/socket.io/?EIO=4&transport=websocket&sid=ba6a356b-3215-49a1-98dd-9a0b80700185 with status 101
and https://myserver:8085/socket.io/?EIO=4&transport=polling&t=dnirjxso with status 200
Likely caused by changes in buffer release management between Netty versions.
Steps to Reproduce
- Generate a Spring Boot application depending on netty-socketio-spring-boot-starter
- configure ssl using application.properties
# socket.io
netty-socket-io.port=8085
netty-socket-io.need-client-auth=false
netty-socket-io.enable-cors=true
netty-socket-io.allow-headers=*
netty-socket-io.origin=*
netty-socket-io.ssl.key-store=file:C:/myapp/server/myapp.p12
netty-socket-io.ssl.key-store-type=PKCS12
netty-socket-io.ssl.key-store-password=password
netty-socket-io.ssl.trust-store=file:C:/myapp/server/myapp.p12
netty-socket-io.ssl.trust-store-type=PKCS12
netty-socket-io.ssl.trust-store-password=password
- connect with a web client using Socket.IO v4.8.1
Expected Behavior
Connection without errors
Actual Behavior
Connection established and then closed with exception.
Environment
- Java Version: 17
- OS: Windows
- Netty-SocketIO Version: 4.0.0-alpha
- Netty Version: Netty 4.2.9.Final
- Module: (core/spring)
Code Example
Logs/Stack Trace
2026-03-16 17:09:04 ERROR com.socketio4j.socketio.listener.DefaultExceptionListener - refCnt: 0
io.netty.util.IllegalReferenceCountException: refCnt: 0
at io.netty.buffer.AbstractByteBuf.ensureAccessible(AbstractByteBuf.java:1480)
at io.netty.buffer.AbstractByteBuf.checkIndex(AbstractByteBuf.java:1390)
at io.netty.buffer.AbstractByteBuf.checkDstIndex(AbstractByteBuf.java:1435)
at io.netty.buffer.CompositeByteBuf.getBytes(CompositeByteBuf.java:1062)
at io.netty.buffer.CompositeByteBuf.getBytes(CompositeByteBuf.java:49)
at io.netty.buffer.ByteBufUtil.decodeString(ByteBufUtil.java:1364)
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:1253)
at io.netty.buffer.AbstractByteBuf.toString(AbstractByteBuf.java:1248)
at com.socketio4j.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:131)
at com.socketio4j.socketio.handler.InPacketHandler.channelRead0(InPacketHandler.java:40)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:120)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:354)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:107)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:331)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:331)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:356)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:172)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.handle(AbstractNioChannel.java:445)
at io.netty.channel.nio.NioIoHandler$DefaultNioRegistration.handle(NioIoHandler.java:388)
at io.netty.channel.nio.NioIoHandler.processSelectedKey(NioIoHandler.java:596)
at io.netty.channel.nio.NioIoHandler.processSelectedKeysOptimized(NioIoHandler.java:571)
at io.netty.channel.nio.NioIoHandler.processSelectedKeys(NioIoHandler.java:512)
at io.netty.channel.nio.NioIoHandler.run(NioIoHandler.java:484)
at io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:225)
at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:196)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1195)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
Additional Context
working combination of versions here mrniko/netty-socketio#1062
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working