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

[v24.2.x] cst/cache: fix use-after-move caused by calling get_exception twice #24200

Merged
Merged
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
22 changes: 14 additions & 8 deletions src/v/cloud_storage/cache_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1288,16 +1288,22 @@ ss::future<> cache::put(
// eager trim, and rethrow the exception.
if (eptr) {
if (!_gate.is_closed()) {
vlog(
cst_log.debug,
"Removing temporary file {}. Exception during copy: {}",
tmp_filepath.native(),
eptr);
auto delete_tmp_fut = co_await ss::coroutine::as_future(
delete_file_and_empty_parents(tmp_filepath.native()));
if (
delete_tmp_fut.failed()
&& !ssx::is_shutdown_exception(delete_tmp_fut.get_exception())) {
vlog(
cst_log.error,
"Failed to delete tmp file {}: {}",
tmp_filepath.native(),
delete_tmp_fut.get_exception());
if (delete_tmp_fut.failed()) {
auto e = delete_tmp_fut.get_exception();
if (!ssx::is_shutdown_exception(e)) {
vlog(
cst_log.error,
"Failed to delete tmp file {}: {}",
tmp_filepath.native(),
e);
}
}
}

Expand Down
Loading