Stack overflow in tokio-runtime-worker
in fork-tree implementation
#9990
-
I keep getting stack overflow in
I think I'm missing something that would prevent such behavior, but don't know what. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
CC @andresilva |
Beta Was this translation helpful? Give feedback.
-
I believe this is where the issue is: substrate/client/consensus/babe/src/lib.rs Lines 1551 to 1566 in c45c1cb In case no blocks are finalized, this recursively traverses the whole tree apparently: substrate/utils/fork-tree/src/lib.rs Lines 683 to 720 in c45c1cb |
Beta Was this translation helpful? Give feedback.
-
The current implementation of BABE keeps all "open" epoch data in an in-memory data structure. Any epoch that has not been finalized is considered "open" since we could in theory build a fork on top of it. This in-memory data structure is the fork-tree and it is currently implemented as a recursive data structure. If a chain doesn't have any finality then this data structure will grow indefinitely and since it's currently recursive it will eventually lead to stack overflows. Even if it was rewritten to be iterative it would eventually lead to other problems like performance regressions (since it grows indefinitely). Since you don't have a finality gadget in your chain I would suggest that you still "manually" finalize blocks by calling |
Beta Was this translation helpful? Give feedback.
The current implementation of BABE keeps all "open" epoch data in an in-memory data structure. Any epoch that has not been finalized is considered "open" since we could in theory build a fork on top of it. This in-memory data structure is the fork-tree and it is currently implemented as a recursive data structure. If a chain doesn't have any finality then this data structure will grow indefinitely and since it's currently recursive it will eventually lead to stack overflows. Even if it was rewritten to be iterative it would eventually lead to other problems like performance regressions (since it grows indefinitely). Since you don't have a finality gadget in your chain I would suggest that…