Skip to content

Commit

Permalink
Close the socket after it is used in StatisticsSenderService
Browse files Browse the repository at this point in the history
The StatisticsSenderService was opening a socket each time a file
closed but did not close it. This eventually lead to jobs with
many files to run out of file descriptors.
  • Loading branch information
Dr15Jones committed Nov 10, 2016
1 parent 16f1986 commit 9d7d693
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Utilities/StorageFactory/src/StatisticsSenderService.cc
Expand Up @@ -195,6 +195,8 @@ StatisticsSenderService::filePreCloseEvent(std::string const& lfn, bool usedFall
if (sock < 0) {
continue;
}
auto close_del = [](int* iSocket) { close(*iSocket); };
std::unique_ptr<int,decltype(close_del)> guard(&sock, close_del);
if (sendto(sock, results.c_str(), results.size(), 0, address->ai_addr, address->ai_addrlen) >= 0) {
break;
}
Expand Down

0 comments on commit 9d7d693

Please sign in to comment.