bookkeeper icon indicating copy to clipboard operation
bookkeeper copied to clipboard

/api/v1/bookie/entry_location_compact NPE

Open ruanliang-hualun opened this issue 1 year ago • 2 comments

BUG REPORT

Describe the bug when i PUT /api/v1/bookie/entry_location_compact, has the NPE error below

curl -X PUT -H "Content-Type: application/json" -d '{"entryLocationRocksDBCompact": "true","entryLocations": "/data_ssd_01/bk/index17/current/locations"}' http://localhost:8001/api/v1/bookie/entry_location_compact

bookkeeper version:4.16.4

2024-06-08T00:45:02,764+0800 [vert.x-eventloop-thread-0] ERROR io.vertx.ext.web.RoutingContext - Unhandled exception in router java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "str" is null at io.vertx.core.buffer.impl.BufferImpl.(BufferImpl.java:84) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.buffer.impl.BufferImpl.(BufferImpl.java:88) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.buffer.impl.BufferImpl.buffer(BufferImpl.java:50) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.buffer.Buffer.buffer(Buffer.java:72) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:366) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at org.apache.bookkeeper.http.vertx.VertxAbstractHandler.processRequest(VertxAbstractHandler.java:59) ~[org.apache.bookkeeper.http-vertx-http-server-4.16.4.jar:4.16.4] at org.apache.bookkeeper.http.vertx.VertxHttpHandlerFactory$1.handle(VertxHttpHandlerFactory.java:46) ~[org.apache.bookkeeper.http-vertx-http-server-4.16.4.jar:4.16.4] at org.apache.bookkeeper.http.vertx.VertxHttpHandlerFactory$1.handle(VertxHttpHandlerFactory.java:42) ~[org.apache.bookkeeper.http-vertx-http-server-4.16.4.jar:4.16.4] at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284) ~[io.vertx-vertx-web-4.3.8.jar:4.3.8] at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177) ~[io.vertx-vertx-web-4.3.8.jar:4.3.8] at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141) ~[io.vertx-vertx-web-4.3.8.jar:4.3.8] at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.doEnd(BodyHandlerImpl.java:358) ~[io.vertx-vertx-web-4.3.8.jar:4.3.8] at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.end(BodyHandlerImpl.java:335) ~[io.vertx-vertx-web-4.3.8.jar:4.3.8] at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:246) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:76) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerRequest.onEnd(Http1xServerRequest.java:581) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerRequest.lambda$pendingQueue$1(Http1xServerRequest.java:130) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:239) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:129) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerRequest.handleEnd(Http1xServerRequest.java:562) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:76) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:153) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerConnection.onEnd(Http1xServerConnection.java:191) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerConnection.onContent(Http1xServerConnection.java:181) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerConnection.handleOther(Http1xServerConnection.java:161) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:149) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:157) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153) ~[io.vertx-vertx-core-4.3.8.jar:4.3.8] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:88) ~[io.netty-netty-codec-http-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[io.netty-netty-codec-4.1.100.Final.jar:4.1.100.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[io.netty-netty-codec-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[io.netty-netty-transport-4.1.100.Final.jar:4.1.100.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[io.netty-netty-common-4.1.100.Final.jar:4.1.100.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[io.netty-netty-common-4.1.100.Final.jar:4.1.100.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.netty-netty-common-4.1.100.Final.jar:4.1.100.Final] at java.lang.Thread.run(Thread.java:842) ~[?:?]

ruanliang-hualun avatar Jun 07 '24 17:06 ruanliang-hualun

I got the parameters wrong. "true" is str not boolean value, The exception was swallowed

image

ruanliang-hualun avatar Jun 08 '24 12:06 ruanliang-hualun

Nice catch! I guess we can have more detailed exception. PRs are welcome.

hezhangjian avatar Jun 09 '24 03:06 hezhangjian

@shoothzj Teacher Zhang, my idea is to add more specific exceptions in addition to Exception, and print error logs. Please assign it to me, I'll create a PR when ready, thanks.

CodePrometheus avatar Aug 12 '24 15:08 CodePrometheus

@CodePrometheus Thanks, I’ve assigned the issue to you. Please feel free to reach out if you need any further assistance. Looking forward to your PR.

hezhangjian avatar Aug 12 '24 15:08 hezhangjian