You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "airborne12 (via GitHub)" <gi...@apache.org> on 2023/04/21 11:33:39 UTC
[GitHub] [doris] airborne12 opened a new pull request, #18914: [Fix](inverted index) fix memory leak when create bkd reader
airborne12 opened a new pull request, #18914:
URL: https://github.com/apache/doris/pull/18914
# Proposed changes
Issue Number: close #xxx
## Problem summary
The function compoundReader->openInput is called three times, and if any of these calls fail, an error is logged, and the function returns early. If one or two of the calls succeed, but the others fail, there might be a situation where the allocated memory for the IndexInput objects is not freed.
To fix this, you could use std::unique_ptr to manage the memory for IndexInput objects. This would automatically clean up the memory when the function goes out of scope.
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [ ] Has document been added or modified
* [ ] Does it need to update dependencies
* [ ] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] airborne12 commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "airborne12 (via GitHub)" <gi...@apache.org>.
airborne12 commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1517688537
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1517711265
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] airborne12 commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "airborne12 (via GitHub)" <gi...@apache.org>.
airborne12 commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1517710815
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1519070622
PR approved by at least one committer and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] xiaokang commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "xiaokang (via GitHub)" <gi...@apache.org>.
xiaokang commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1518569271
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1518916726
clang-tidy review says "All clean, LGTM! :+1:"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] airborne12 commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "airborne12 (via GitHub)" <gi...@apache.org>.
airborne12 commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1518916574
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on a diff in pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #18914:
URL: https://github.com/apache/doris/pull/18914#discussion_r1173667228
##########
be/src/olap/rowset/segment_v2/inverted_index_compound_reader.cpp:
##########
@@ -244,6 +244,17 @@ int64_t DorisCompoundReader::fileLength(const char* name) const {
return e->length;
}
+bool DorisCompoundReader::openInput(const char* name,
Review Comment:
warning: out-of-line definition of 'openInput' does not match any declaration in 'doris::segment_v2::DorisCompoundReader' [clang-diagnostic-error]
```cpp
bool DorisCompoundReader::openInput(const char* name,
^
```
##########
be/src/olap/rowset/segment_v2/inverted_index_compound_reader.h:
##########
@@ -82,6 +82,8 @@ class CLUCENE_EXPORT DorisCompoundReader : public lucene::store::Directory {
int64_t fileLength(const char* name) const override;
bool openInput(const char* name, lucene::store::IndexInput*& ret, CLuceneError& err,
int32_t bufferSize = -1) override;
+ bool openInput(const char* name, std::unique_ptr<lucene::store::IndexInput>& ret,
Review Comment:
warning: no template named 'unique_ptr' in namespace 'std' [clang-diagnostic-error]
```cpp
bool openInput(const char* name, std::unique_ptr<lucene::store::IndexInput>& ret,
^
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] github-actions[bot] commented on pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #18914:
URL: https://github.com/apache/doris/pull/18914#issuecomment-1518466572
PR approved by anyone and no changes requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morningman merged pull request #18914: [Fix](inverted index) fix memory leak when create bkd reader
Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman merged PR #18914:
URL: https://github.com/apache/doris/pull/18914
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org