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: gremlin exec timeout cause statement unclose #1643

Merged
merged 5 commits into from
Nov 12, 2021

Conversation

z7658329
Copy link
Member

Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix #1639

Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix apache#1639
Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix apache#1639
@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #1643 (2d0a0e9) into master (299449b) will decrease coverage by 0.02%.
The diff coverage is 45.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1643      +/-   ##
============================================
- Coverage     66.99%   66.96%   -0.03%     
+ Complexity     7069     7067       -2     
============================================
  Files           421      421              
  Lines         34646    34655       +9     
  Branches       4798     4798              
============================================
- Hits          23210    23208       -2     
- Misses         9094     9102       +8     
- Partials       2342     2345       +3     
Impacted Files Coverage Δ
.../hugegraph/backend/store/BackendEntryIterator.java 60.75% <33.33%> (-4.03%) ⬇️
...om/baidu/hugegraph/backend/query/QueryResults.java 71.42% <100.00%> (+0.27%) ⬆️
...va/com/baidu/hugegraph/task/ServerInfoManager.java 71.34% <0.00%> (-2.25%) ⬇️
...a/com/baidu/hugegraph/backend/query/Condition.java 79.42% <0.00%> (-0.37%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 299449b...2d0a0e9. Read the comment docs.

return this.query.reachLimit(count);
try {
checkInterrupted();
return this.query.reachLimit(count);
Copy link
Contributor

Choose a reason for hiding this comment

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

it's ok to just catch checkInterrupted(), we assume other exception will be handled by upper layer.

try {
checkInterrupted();
return this.query.reachLimit(count);
} catch (BackendException e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

catch Throwable

LOG.warn("Failed to close backend entry iterator for interrupted query", ex);
}
throw e;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

also catch QueryResults.toList(Iterator<T> iterator) which may cause leak if exception occurred, and close in finally block:

try {
    return new ListIterator<>(Query.DEFAULT_CAPACITY, iterator);
} finally {
    CloseableIterator.closeIterator(iterator);
}

Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix apache#1639
Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix apache#1639
} catch (Throwable e) {
try {
this.close();
} catch (Exception ex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

catch(Throwable ex)

checkInterrupted();
try {
checkInterrupted();
} catch (Throwable e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need a space between "catch ("

Fix bug: gremlin语句执行超时 将导致内存泄漏statement未释放

fix apache#1639
@javeme javeme merged commit 2dcfbfa into apache:master Nov 12, 2021
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.

[Bug] gremlin语句执行超时 将导致内存泄漏statement未释放
4 participants