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

debug_metrics Method Error #7383

Closed
sbChoiDeveloper opened this issue Jul 26, 2024 · 1 comment · Fixed by #7499
Closed

debug_metrics Method Error #7383

sbChoiDeveloper opened this issue Jul 26, 2024 · 1 comment · Fixed by #7499
Assignees
Labels
bug Something isn't working good first issue Good for newcomers P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion) RPC

Comments

@sbChoiDeveloper
Copy link

sbChoiDeveloper commented Jul 26, 2024

Description

When invoking the debug_metrics method, a ClassCastException is thrown.

Acceptance Criteria

  • The debug_metrics method should return metrics data without throwing exceptions.

Steps to Reproduce (Bug)

  1. Start Besu with the following command:
    Execute the following curl command:

curl -X POST --data '{"jsonrpc":"2.0","method":"debug_metrics","params":[],"id":1}' http://192.168.40.91:8545
Expected behavior: The debug_metrics method should execute without throwing an exception and return the appropriate metrics data.
Actual behavior: A ClassCastException is thrown, indicating that a java.lang.Double cannot be cast to a java.util.Map.
Frequency: 100% of the time.

Logs (if a bug)
2024-07-26 11:04:29.415+09:00 | vert.x-worker-thread-9 | ERROR | BaseJsonRpcProcessor | Error processing method: debug_metrics []
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.util.Map (java.lang.Double and java.util.Map are in module java.base of loader 'bootstrap')
at org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugMetrics.getNextMapLevel(DebugMetrics.java:75)
at org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugMetrics.addLabelledObservation(DebugMetrics.java:64)
at org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugMetrics.addObservation(DebugMetrics.java:57)
at org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugMetrics.lambda$response$0(DebugMetrics.java:46)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.concurrent.ConcurrentHashMap$KeySpliterator.forEachRemaining(ConcurrentHashMap.java:3573)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.concurrent.ConcurrentHashMap$KeySpliterator.forEachRemaining(ConcurrentHashMap.java:3573)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugMetrics.response(DebugMetrics.java:46)
at org.hyperledger.besu.ethereum.api.jsonrpc.execution.BaseJsonRpcProcessor.process(BaseJsonRpcProcessor.java:44)
at org.hyperledger.besu.ethereum.api.jsonrpc.execution.TracedJsonRpcProcessor.process(TracedJsonRpcProcessor.java:54)
at org.hyperledger.besu.ethereum.api.jsonrpc.execution.TimedJsonRpcProcessor.process(TimedJsonRpcProcessor.java:45)
at org.hyperledger.besu.ethereum.api.jsonrpc.execution.JsonRpcExecutor.execute(JsonRpcExecutor.java:92)
at org.hyperledger.besu.ethereum.api.handlers.AbstractJsonRpcExecutor.executeRequest(AbstractJsonRpcExecutor.java:87)
at org.hyperledger.besu.ethereum.api.handlers.JsonRpcObjectExecutor.execute(JsonRpcObjectExecutor.java:57)
at org.hyperledger.besu.ethereum.api.handlers.JsonRpcExecutorHandler.lambda$handler$0(JsonRpcExecutorHandler.java:57)
at java.base/java.util.Optional.ifPresentOrElse(Optional.java:196)
at org.hyperledger.besu.ethereum.api.handlers.JsonRpcExecutorHandler.lambda$handler$2(JsonRpcExecutorHandler.java:54)
at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:191)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:279)
at io.vertx.core.impl.ContextImpl.lambda$internalExecuteBlocking$2(ContextImpl.java:210)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1583)

Besu version 24.6.0
Software version: besu/v24.6.0/linux-x86_64/openjdk-java-21
Java version: openjdk 21
OS Name & Version: Ubuntu 20.04.2 LTS

Please solve this problem....

@macfarla macfarla added the good first issue Good for newcomers label Jul 29, 2024
@non-fungible-nelson non-fungible-nelson added bug Something isn't working P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion) RPC labels Jul 30, 2024
@non-fungible-nelson
Copy link
Contributor

Might be a candidate for integration testing - repeatable RPC testing. Thank you for this report

@cloudspores cloudspores self-assigned this Aug 19, 2024
cloudspores added a commit to cloudspores/besu that referenced this issue Aug 20, 2024
This commit resolves an issue where Double values in nested metric
structures were incorrectly cast to Map objects, causing a
ClassCastException. The fix allows for proper handling of both
direct values and nested structures at the same level.

A comprehensive test case has been added to reproduce the bug and
verify the fix, ensuring that complex, dynamically nested metric
structures can be handled without errors.

Resolves: hyperledger#7383
Signed-off-by: Ade Lucas <[email protected]>
cloudspores added a commit to cloudspores/besu that referenced this issue Aug 20, 2024
This commit adds a new entry to `CHANGELOG.md` detailing the fix
for the `ClassCastException` in `DebugMetrics`. Additionally,
`DebugMetricsTest.java` has been reformatted using `spotlessApply`
to ensure code style consistency.

These changes contribute to maintaining clear documentation and
code quality in the project.

Resolves: hyperledger#7383
Signed-off-by: Ade Lucas <[email protected]>
cloudspores added a commit to cloudspores/besu that referenced this issue Aug 20, 2024
This commit resolves an issue where Double values in nested metric
structures were incorrectly cast to Map objects, causing a
ClassCastException. The fix allows for proper handling of both
direct values and nested structures at the same level.

A comprehensive test case has been added to reproduce the bug and
verify the fix, ensuring that complex, dynamically nested metric
structures can be handled without errors.

Resolves: hyperledger#7383
Signed-off-by: Ade Lucas <[email protected]>
cloudspores added a commit to cloudspores/besu that referenced this issue Aug 20, 2024
This commit adds a new entry to `CHANGELOG.md` detailing the fix
for the `ClassCastException` in `DebugMetrics`. Additionally,
`DebugMetricsTest.java` has been reformatted using `spotlessApply`
to ensure code style consistency.

These changes contribute to maintaining clear documentation and
code quality in the project.

Resolves: hyperledger#7383
Signed-off-by: Ade Lucas <[email protected]>
macfarla added a commit that referenced this issue Aug 23, 2024
* Fix ClassCastException in DebugMetrics nested structures

This commit resolves an issue where Double values in nested metric
structures were incorrectly cast to Map objects, causing a
ClassCastException. The fix allows for proper handling of both
direct values and nested structures at the same level.

A comprehensive test case has been added to reproduce the bug and
verify the fix, ensuring that complex, dynamically nested metric
structures can be handled without errors.

Resolves: #7383

Signed-off-by: Ade Lucas <[email protected]>

---------

Signed-off-by: Ade Lucas <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: Snazzy <[email protected]>
Signed-off-by: Danno Ferrin <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda-Clerke <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
Co-authored-by: garyschulte <[email protected]>
Co-authored-by: Fabio Di Fabio <[email protected]>
Co-authored-by: gringsam <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Co-authored-by: Danno Ferrin <[email protected]>
Co-authored-by: Matilda-Clerke <[email protected]>
gconnect pushed a commit to gconnect/besu that referenced this issue Aug 26, 2024
…#7383] (hyperledger#7499)

* Fix ClassCastException in DebugMetrics nested structures

This commit resolves an issue where Double values in nested metric
structures were incorrectly cast to Map objects, causing a
ClassCastException. The fix allows for proper handling of both
direct values and nested structures at the same level.

A comprehensive test case has been added to reproduce the bug and
verify the fix, ensuring that complex, dynamically nested metric
structures can be handled without errors.

Resolves: hyperledger#7383

Signed-off-by: Ade Lucas <[email protected]>

---------

Signed-off-by: Ade Lucas <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: Snazzy <[email protected]>
Signed-off-by: Danno Ferrin <[email protected]>
Signed-off-by: Matilda Clerke <[email protected]>
Signed-off-by: Matilda-Clerke <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
Co-authored-by: garyschulte <[email protected]>
Co-authored-by: Fabio Di Fabio <[email protected]>
Co-authored-by: gringsam <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Co-authored-by: Danno Ferrin <[email protected]>
Co-authored-by: Matilda-Clerke <[email protected]>
Signed-off-by: gconnect <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers P3 Medium (ex: JSON-RPC request not working with a specific client library due to loose spec assumtion) RPC
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants