-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
Implement panic recovery in HandleGetStateByRange #5084
base: main
Are you sure you want to change the base?
Conversation
…f query context. Add test case to verify recovery behavior during panic scenarios. Signed-off-by: David VIEJO <[email protected]>
@dviejokfs I really want to get to the bottom of the error.
I suggest you to insert logs in the place where you make changes and logs in the call in the chaincode. And check that the input parameters in GetStateByRange are correct and do not change along the whole path. |
@pfi79 Here you go
|
@pfi79 |
it's better to discuss it here, so that others can suggest something. |
It's a stacktrace of what version of fabric. |
@pfi79 2.5.5 |
If the goleveldb library is indeed the culprit, I would recover add as close to the library itself as possible. For example, here somewhere /common/ledger/util/leveldbhelper/leveldb_helper.go:159 And not only in the iterator function itself, but in other functions as well, so that working with this library doesn't add panic somewhere else. |
@pfi79 so you would add it in the functions for the file common/ledger/util/leveldbhelper/leveldb_helper.go? |
I'd like to start by clarifying the cause of the panic. |
I agree with @pfi79 , you are very close, might as well complete the analysis and find the exact root cause so that we know it is handled completely. In addition to more logging in Fabric, you can add more logging in goleveldb in your vendor directory before building the peer. Then compare the log entries when it is working versus when it is not working. |
Type of change
Description
This pull request introduces several improvements in the
HandleGetStateByRange
function within thecore/chaincode/handler.go
file and theGetStateRangeScanIteratorWithPagination
function within thecore/ledger/kvledger/txmgmt/statedb/stateleveldb/stateleveldb.go
file. The changes include:HandleGetStateByRange
function to log errors and clean up any query contexts that may have been created.GetStateRangeScanIteratorWithPagination
to handle potential panics and return meaningful error messages.Additional details
These changes help improve the robustness of the code by handling potential panics and validating inputs, which can help prevent unexpected errors and improve the overall stability of the system.
Related issues
#5001