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

Fix leveldb file increase #1333

Closed

Conversation

Ashuaidehao
Copy link
Contributor

Release file handles.Relate to neo-project/neo-modules#139

@@ -162,6 +162,7 @@ protected override bool PreExecuteInstruction()
ApplicationEngine engine = new ApplicationEngine(TriggerType.Application, container, snapshot, extraGAS, testMode);
engine.LoadScript(script);
engine.Execute();
engine.Dispose();
Copy link
Member

Choose a reason for hiding this comment

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

The engine should be disposed by the caller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems most caller just call it one time without release, we need a way to fix it once for all.
(https://github.com/neo-project/neo-plugins/blob/29fee59944fb4ae3a9e8d644c3d334fd3df5b474/RpcNep5Tracker/RpcNep5Tracker.cs#L168)
Changing it in neo.dll could eliminate the hidden trouble.
Ortherwise, we need check all plugins who call it and refactor.

Copy link
Member

Choose a reason for hiding this comment

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

You need to access the object, why dispose it before using?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For most conditions, we just use the method to get the run results not engine itself.
Sometime the smartcontract may invoke needing more gas than the gas limit. If this happen when opening leveldb iterators, the engine interrupts and these iterators cannot close normally. Unless call engine "dispose" manually.
Seem gas limit interrupts may happen in many unpredictable situations, fix the hidden leak trouble here could nip in the bud.

@erikzhang erikzhang closed this Dec 6, 2019
@erikzhang
Copy link
Member

erikzhang commented Dec 6, 2019

See #1336, neo-project/neo-node#501, neo-project/neo-modules#156

@Ashuaidehao Ashuaidehao deleted the Fix-leveldb-leak branch June 3, 2021 02:50
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.

2 participants