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

[BUG]: Could not create state node #845

Closed
1 task done
mvandeberg opened this issue Nov 22, 2024 · 3 comments · Fixed by #846
Closed
1 task done

[BUG]: Could not create state node #845

mvandeberg opened this issue Nov 22, 2024 · 3 comments · Fixed by #846
Assignees
Labels
bug Something isn't working

Comments

@mvandeberg
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Occasionally chain will log that it could not create new state node.

While working on p2p, I found that this message was being logged when a child block was attempting to be applied while the parent block is being applied. This leads to a race condition that can result in timeouts within p2p. The race condition is not good in chain either.

When the parent block is being finalized, we release all locks and request a unique lock in order to bump head block, fork heads, and LIB atomically. When creating a new state node, state db waits for the parent node to be finalized, holding a lock while it does. Thankfully, creating a state node does use an internal timeout otherwise this would result in a complete deadlock of the node.

Expected behavior

We should detect this condition and return a meaningful error. I suggest unknown_previous_block for two reasons.

  1. p2p is already handling this error and will attempt to re-apply the block when the parent is applied.
  2. Internal to chain, this creates a consistent definition for the error. We only know of a block once it has been successfully applied. The error in this case makes sense because the parent node has not yet finished applying, therefore the previous block is unknown.

Steps to reproduce

No response

Environment

- OS:

Anything else?

No response

@ethsdev
Copy link

ethsdev commented Dec 3, 2024

Hi, @mvandeberg , sorry for leaving comment here without your agreement and respecting the team rule. Because I wanna contribute to koinos team's development and join your team, so I am going to solve issues. So could you give me some issue to be solved quickly as test task?

@sgerbino
Copy link
Member

sgerbino commented Dec 4, 2024

Hi, @mvandeberg , sorry for leaving comment here without your agreement and respecting the team rule. Because I wanna contribute to koinos team's development and join your team, so I am going to solve issues. So could you give me some issue to be solved quickly as test task?

This is a good beginner task: #676
It involves defining a new protobuf message in https://github.com/koinos/koinos-proto
Reach out to me, @sgerbino, or @mvandeberg on Telegram in #Developers.

sgerbino added a commit that referenced this issue Dec 4, 2024
#845: Return unknown previous block when the parent node is not final…
@ethsdev
Copy link

ethsdev commented Dec 7, 2024

sure, I will do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants