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

[Neo Core] Ensure LevelDB Snapshot Only be Used by One Thread #3425

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Jul 18, 2024

Description

Leveldb is not thread safe, thus we should be able to avoid leveldb being used cross threads.

Fixes # (issue)

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • TestOneThreadLevelDbSnapshotPut
  • TestSingleExtraThreadLevelDbSnapshotPut
  • TestMultiThreadLevelDbSnapshotPut

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@cschuchardt88 cschuchardt88 left a comment

Choose a reason for hiding this comment

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

Why are you trying to do this?

@Jim8y
Copy link
Contributor Author

Jim8y commented Jul 18, 2024

Why are you trying to do this?

trying to avoid leveldb mis use. Like in the previous unhandled plugin exception pr, snapshot was careless and unintentionally used in multiple threads, but there was no warning or exception at all. Thus having this pr, if it can not being used cross thread, then it should throw exception if its being used that way.

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

This was tested in a real environment?

@cschuchardt88
Copy link
Member

cschuchardt88 commented Jul 23, 2024

This was tested in a real environment?

This should be tested in real environment. Reason is the blockchain network (node) is multi-threaded. Each request runs on a different thread, because of Akka.net.

Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

Hi @Jim8y , maybe move to draft or this still should be reviewed?

@Jim8y Jim8y marked this pull request as draft July 29, 2024 14:14
@cschuchardt88
Copy link
Member

This is way to much work needed. Plus it isn't correctly. #3414 fixes the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants