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

block header cache not initialized before used #7601

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

lu-pinto
Copy link
Contributor

PR description

After this commit the block headers cache is being used before it's initialized which creates an NPE while setting up the metrics:

Caused by: java.lang.NullPointerException: Cannot invoke \"java.util.Optional.map(java.util.function.Function)\" because \"this.blockHeadersCache\" is null
    at org.hyperledger.besu.ethereum.chain.DefaultBlockchain.getBlockHeader(DefaultBlockchain.java:328)
    at java.base/java.util.Optional.flatMap(Optional.java:289)
    at org.hyperledger.besu.ethereum.chain.DefaultBlockchain.getFinalizedBlockNumber(DefaultBlockchain.java:775)
    at org.hyperledger.besu.plugin.services.MetricsSystem.lambda$createLongGauge$1(MetricsSystem.java:160)
    at org.hyperledger.besu.metrics.prometheus.CurrentValueCollector.collect(CurrentValueCollector.java:55)
    ...

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

@lu-pinto lu-pinto force-pushed the reorder-DefaultBlockchain-init branch from 44ec697 to 2a9d85b Compare September 10, 2024 22:59
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@macfarla macfarla enabled auto-merge (squash) September 10, 2024 23:01
Signed-off-by: Luis Pinto <[email protected]>
auto-merge was automatically disabled September 10, 2024 23:13

Head branch was pushed to by a user without write access

@macfarla macfarla enabled auto-merge (squash) September 10, 2024 23:17
@macfarla macfarla merged commit 46636c7 into hyperledger:main Sep 10, 2024
41 checks passed
@lu-pinto lu-pinto deleted the reorder-DefaultBlockchain-init branch September 11, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants