8000 Rest Batch Handler Memleak [devel] by maierlars · Pull Request #6442 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Rest Batch Handler Memleak [devel] #6442

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

Merged
merged 1 commit into from
Sep 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed memory leak due to cyclic references of shared pointer.
  • Loading branch information
lamai93 committed Sep 10, 2018
commit 515555eeb623e350c66c483e30ffa1c52dd4769d
10 changes: 5 additions & 5 deletions arangod/RestHandler/RestBatchHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ RestStatus RestBatchHandler::executeVst() {
return RestStatus::DONE;
}

void RestBatchHandler::processSubHandlerResult(std::shared_ptr<RestHandler> const& handler) {
void RestBatchHandler::processSubHandlerResult(RestHandler const& handler) {
HttpResponse* httpResponse = dynamic_cast<HttpResponse*>(_response.get());

HttpResponse* partResponse =
dynamic_cast<HttpResponse*>(handler->response());
dynamic_cast<HttpResponse*>(handler.response());

if (partResponse == nullptr) {
generateError(rest::ResponseCode::BAD, TRI_ERROR_INTERNAL,
Expand Down Expand Up @@ -230,12 +230,12 @@ bool RestBatchHandler::executeNextHandler() {
// ignore any errors here, will be handled later by inspecting the response
try {
ExecContextScope scope(nullptr);// workaround because of assertions
handler->runHandler([this, self, handler](RestHandler*) {
processSubHandlerResult(handler);
handler->runHandler([this, self](RestHandler *handler) {
processSubHandlerResult(*handler);

});
} catch (...) {
processSubHandlerResult(handler);
processSubHandlerResult(*handler.get());
}
}
);
Expand Down
4 changes: 2 additions & 2 deletions arangod/RestHandler/RestBatchHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct MultipartMessage {
: boundary(boundary),
boundaryLength(boundaryLength),
messageStart(messageStart),
messageEnd(messageEnd) {}
messageEnd(messageEnd) {}
MultipartMessage() : MultipartMessage("", 0, "", "") {}

char const* boundary;
Expand Down Expand Up @@ -85,7 +85,7 @@ class RestBatchHandler : public RestVocbaseBaseHandler {

private:
bool executeNextHandler();
void processSubHandlerResult(std::shared_ptr<RestHandler> const& handler);
void processSubHandlerResult(RestHandler const& handler);

MultipartMessage _multipartMessage;
SearchHelper _helper;
Expand Down
0