Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlEventDecoder triggers IllegalReferenceCountException at AbstractByteBuf [SPR-15707] #20264

Closed
spring-projects-issues opened this issue Jun 27, 2017 · 4 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 27, 2017

Kengo TODA opened SPR-15707 and commented

When I use XmlEventDecoder with WebClient & Reactor, this class triggered IllegalReferenceCountException(refCnt = 0) in AbstractByteBuf. To solve this problem, we need to add -Dio.netty.buffer.bytebuf.checkAccessible=false as JVM argument.

Code to reproduce depends on both of Core 5.0.0.RC2 and Web 5.0.0.RC2,
not sure which caused this problem. I'll push test to reproduce later.

Environment

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"

Stacktrace

io.netty.util.IllegalReferenceCountException: refCnt: 0
at io.netty.buffer.AbstractByteBuf.ensureAccessible(AbstractByteBuf.java:1408)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1394)
at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1383)
at io.netty.buffer.AbstractByteBuf.readBytes(AbstractByteBuf.java:850)
at io.netty.buffer.ByteBufInputStream.read(ByteBufInputStream.java:179)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2928)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:302)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1793)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipSpaces(XMLEntityScanner.java:1538)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:838)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:553)
at com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
at com.sun.xml.internal.stream.XMLEventReaderImpl.next(XMLEventReaderImpl.java:248)
at reactor.core.publisher.FluxIterable$IterableSubscription.fastPath(FluxIterable.java:227)
at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:141)
at reactor.core.publisher.MonoFlatMapMany$FlatMapMain.onSubscribeInner(MonoFlatMapMany.java:139)
at reactor.core.publisher.MonoFlatMapMany$FlatMapInner.onSubscribe(MonoFlatMapMany.java:224)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:89)
at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:54)
at reactor.core.publisher.MonoFlatMapMany$FlatMapMain.onNext(MonoFlatMapMany.java:181)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:919)
at reactor.core.publisher.MonoReduce$ReduceSubscriber.onComplete(MonoReduce.java:125)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:130)
at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:130)
at reactor.ipc.netty.channel.FluxReceive.terminateReceiver(FluxReceive.java:375)
at reactor.ipc.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:198)
at reactor.ipc.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:338)
at reactor.ipc.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:343)
at reactor.ipc.netty.channel.ChannelOperations.onHandlerTerminate(ChannelOperations.java:419)
at reactor.ipc.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:566)
at reactor.ipc.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:125)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:233)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Thread.java:745)


Affects: 5.0 RC2

Referenced from: commits spring-projects/spring-framework-issues@0681c37, spring-projects/spring-framework-issues@5b236d3

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 27, 2017

Kengo TODA commented

I've pushed the code to reproduce this problem to:
spring-projects/spring-framework-issues#160

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 29, 2017

Arjen Poutsma commented

Fixed in 9d7b850

Thanks for reporting this, and creating the test project!

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 29, 2017

Kengo TODA commented

Thanks, I'll wait 5.0 RC3 release!

1 similar comment
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jun 29, 2017

Kengo TODA commented

Thanks, I'll wait 5.0 RC3 release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants