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

/wallet/getnodeinfo error : StringIndexOutOfBoundsException #5592

Closed
317787106 opened this issue Nov 21, 2023 · 4 comments · Fixed by #5657
Closed

/wallet/getnodeinfo error : StringIndexOutOfBoundsException #5592

317787106 opened this issue Nov 21, 2023 · 4 comments · Fixed by #5657
Labels
topic: gRPC/HTTP api rpc/http related issue type:bug

Comments

@317787106
Copy link
Contributor

317787106 commented Nov 21, 2023

System information

Java-tron version: v4.7.3 /Java1.8
OS & Version: Linux

Expected behavior

  • expect /wallet/getnodeinfo endpoint to return the right NodeInfo.

Actual behavior

The exception occurs when calling this endpoint: java.lang.StringIndexOutOfBoundsException: String index out of range: 699

Backtrace

15:06:43.498 ERROR [qtp583852441-67461] [API](GetNodeInfoServlet.java:27)
    java.lang.StringIndexOutOfBoundsException: String index out of range: 699
        at java.lang.String.<init>(String.java:205)
        at java.lang.StringBuilder.toString(StringBuilder.java:407)
        at org.tron.core.capsule.BlockCapsule.toString(BlockCapsule.java:336)
        at java.lang.String.valueOf(String.java:2994)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at java.util.AbstractCollection.toString(AbstractCollection.java:462)
        at java.lang.String.valueOf(String.java:2994)
        at java.lang.StringBuilder.append(StringBuilder.java:131)
        at org.tron.core.services.WitnessProductBlockService$CheatWitnessInfo.toString(WitnessProductBlockService.java:112)
        at org.tron.core.services.NodeInfoService.setCheatWitnessInfo(NodeInfoService.java:206)
        at org.tron.core.services.NodeInfoService.getNodeInfo(NodeInfoService.java:67)
        at org.tron.core.services.NodeInfoService$$FastClassBySpringCGLIB$$7388b67d.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
        at org.tron.common.prometheus.MetricAspect.aroundAdviceMetricTime(MetricAspect.java:22)
        at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
        at org.tron.core.services.NodeInfoService$$EnhancerBySpringCGLIB$$2b64cc54.getNodeInfo(<generated>)
        at org.tron.core.services.http.GetNodeInfoServlet.doGet(GetNodeInfoServlet.java:23)
        at org.tron.core.services.http.GetNodeInfoServlet.doPost(GetNodeInfoServlet.java:37)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at org.tron.core.services.http.RateLimiterServlet.service(RateLimiterServlet.java:105)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1656)
        at org.tron.core.services.filter.HttpInterceptor.doFilter(HttpInterceptor.java:40)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
        at org.tron.core.services.filter.HttpApiAccessFilter.doFilter(HttpApiAccessFilter.java:42)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
        at org.tron.core.services.filter.LiteFnQueryHttpFilter.doFilter(LiteFnQueryHttpFilter.java:120)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1626)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:552)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:505)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:516)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
        at java.lang.Thread.run(Thread.java:748)

@lurais
Copy link
Contributor

lurais commented Nov 24, 2023

May use StringBuffer to replace it

@317787106
Copy link
Contributor Author

May use StringBuffer to replace it

@lurais This is one of the solutions.

@jwrct
Copy link
Contributor

jwrct commented Nov 24, 2023

@317787106 Do you already have a solution? And has the solution been validated?

@317787106
Copy link
Contributor Author

@317787106 Do you already have a solution? And has the solution been validated?

@jwrct Yes, you can see this solution in pr 5594. there is a testcase.

@317787106 317787106 changed the title Fix bug of method toString in BlockCapsule Resolve concurrency exception issue for toString in BlockCapsule Jan 9, 2024
@halibobo1205 halibobo1205 changed the title Resolve concurrency exception issue for toString in BlockCapsule /wallet/getnodeinfo : java.lang.StringIndexOutOfBoundsException Jan 9, 2024
@halibobo1205 halibobo1205 added the topic: gRPC/HTTP api rpc/http related issue label Jan 10, 2024
@halibobo1205 halibobo1205 changed the title /wallet/getnodeinfo : java.lang.StringIndexOutOfBoundsException /wallet/getnodeinfo error : StringIndexOutOfBoundsException Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: gRPC/HTTP api rpc/http related issue type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants