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

Mongo Integration: java.lang.IllegalStateException: Read only 0 bytes #1295

Closed
recursivecodes opened this issue Jan 25, 2022 · 1 comment · Fixed by micronaut-projects/micronaut-serialization#122
Labels
type: bug Something isn't working
Milestone

Comments

@recursivecodes
Copy link
Contributor

recursivecodes commented Jan 25, 2022

Expected Behavior

The application should persist entity.

Actual Behaviour

Receive exception:

15:38:49.758 [default-nioEventLoopGroup-1-2] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: Read only 0 bytes!
java.lang.IllegalStateException: Read only 0 bytes!
	at io.micronaut.serde.bson.AbstractBsonMapper.toByteBuffer(AbstractBsonMapper.java:180)
	at io.micronaut.serde.bson.AbstractBsonMapper.access$000(AbstractBsonMapper.java:46)
	at io.micronaut.serde.bson.AbstractBsonMapper$1.parseOne(AbstractBsonMapper.java:124)
	at io.micronaut.serde.support.util.BufferingJsonNodeProcessor.parseOne(BufferingJsonNodeProcessor.java:168)
	at io.micronaut.serde.support.util.BufferingJsonNodeProcessor.processOne(BufferingJsonNodeProcessor.java:136)
	at io.micronaut.serde.support.util.BufferingJsonNodeProcessor.spread(BufferingJsonNodeProcessor.java:94)
	at io.micronaut.serde.support.util.BufferingJsonNodeProcessor.spread(BufferingJsonNodeProcessor.java:39)
	at io.micronaut.serde.support.util.SpreadProcessor.workImpl(SpreadProcessor.java:191)
	at io.micronaut.serde.support.util.SpreadProcessor.work(SpreadProcessor.java:123)
	at io.micronaut.serde.support.util.SpreadProcessor.onNext(SpreadProcessor.java:99)
	at io.micronaut.http.server.netty.jackson.JsonContentProcessor.onData(JsonContentProcessor.java:148)
	at io.micronaut.http.server.netty.AbstractHttpContentProcessor.doOnNext(AbstractHttpContentProcessor.java:78)
	at io.micronaut.http.server.netty.AbstractHttpContentProcessor.doOnNext(AbstractHttpContentProcessor.java:36)
	at io.micronaut.core.async.subscriber.CompletionAwareSubscriber.onNext(CompletionAwareSubscriber.java:52)
	at io.micronaut.http.netty.reactive.HandlerPublisher.publishMessage(HandlerPublisher.java:378)
	at io.micronaut.http.netty.reactive.HandlerPublisher.channelRead(HandlerPublisher.java:334)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.micronaut.http.netty.stream.HttpStreamsHandler.handleReadHttpContent(HttpStreamsHandler.java:304)
	at io.micronaut.http.netty.stream.HttpStreamsHandler.channelRead(HttpStreamsHandler.java:269)
	at io.micronaut.http.netty.stream.HttpStreamsServerHandler.channelRead(HttpStreamsServerHandler.java:123)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
	at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
	at io.netty.handler.codec.http.HttpServerKeepAliveHandler.channelRead(HttpServerKeepAliveHandler.java:64)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:200)
	at io.netty.handler.flow.FlowControlHandler.read(FlowControlHandler.java:139)
	at io.netty.channel.AbstractChannelHandlerContext.invokeRead(AbstractChannelHandlerContext.java:686)
	at io.netty.channel.AbstractChannelHandlerContext.read(AbstractChannelHandlerContext.java:671)
	at io.micronaut.http.netty.reactive.HandlerPublisher.requestDemand(HandlerPublisher.java:163)
	at io.micronaut.http.netty.stream.HttpStreamsHandler$2.requestDemand(HttpStreamsHandler.java:260)
	at io.micronaut.http.netty.reactive.HandlerPublisher$ChannelSubscription.receivedDemand(HandlerPublisher.java:547)
	at io.micronaut.http.netty.reactive.HandlerPublisher$ChannelSubscription.lambda$request$0(HandlerPublisher.java:474)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
	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:834)

Steps To Reproduce

  1. Check out https://github.com/recursivecodes/mn-atp-mongo
  2. Run with valid ADB Mongo URL
  3. Send POST to /book
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"title": "The Stand", "pages": 454}' \
  localhost:8080/book

Environment Information

  • OSX Monterrey
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03)
OpenJDK 64-Bit Server VM GraalVM CE 20.2.0 (build 11.0.8+10-jvmci-20.2-b03, mixed mode, sharing)

Example Application

https://github.com/recursivecodes/mn-atp-mongo

Version

3.1.4

@graemerocher
Copy link
Contributor

Will be fixed in core when micronaut-projects/micronaut-core#6816 is merged

@dstepanov dstepanov added the type: bug Something isn't working label Mar 21, 2022
@dstepanov dstepanov added this to the 3.3.0 milestone Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants