Skip to content

Commit

Permalink
PerfProfiler: on exit, or target proc. termination, remove all symbol…
Browse files Browse the repository at this point in the history
…ization artifacts create inside the target container.

Summary: TSIA

Test Plan: Tested on local dev. cluster.

Reviewers: #stirling, oazizi

Reviewed By: #stirling, oazizi

JIRA Issues: PP-2982, PP-3252

Signed-off-by: Pete Stevenson <jps@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D10788

GitOrigin-RevId: b3ff738
  • Loading branch information
Pete Stevenson authored and copybaranaut committed Feb 16, 2022
1 parent b6c912f commit 1a5f8eb
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,21 @@ JavaSymbolizationContext::JavaSymbolizationContext(const struct upid_t& target_u
host_artifacts_path_resolved_ = true;
}

JavaSymbolizationContext::~JavaSymbolizationContext() { symbol_file_->close(); }
JavaSymbolizationContext::~JavaSymbolizationContext() {
symbol_file_->close();

if (host_artifacts_path_resolved_) {
// Remove the host artifacts path entirely; this cleans up all the files (and the subdir) we
// created inside of the target container mount namespace.
const auto& sysconfig = system::Config::GetInstance();
const std::filesystem::path host_artifacts_path = sysconfig.ToHostPath(host_artifacts_path_);
const Status remove_status = fs::RemoveAll(host_artifacts_path);
if (!remove_status.ok()) {
char const* const fmt = "Could not remove host artifacts path: $0, $1.";
LOG(WARNING) << absl::Substitute(fmt, host_artifacts_path_.string(), remove_status.msg());
}
}
}

std::string_view JavaSymbolizationContext::Symbolize(const uintptr_t addr) {
if (requires_refresh_) {
Expand Down

0 comments on commit 1a5f8eb

Please sign in to comment.