Skip to content

v5.0.x: Singletons need to create their own session directory tree #13036

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
Jan 16, 2025
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
27 changes: 24 additions & 3 deletions ompi/runtime/ompi_rte.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights
* reserved.
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
* Copyright (c) 2021-2022 IBM Corporation. All rights reserved.
* $COPYRIGHT$
*/
Expand Down Expand Up @@ -69,6 +69,7 @@ opal_process_name_t pmix_name_invalid = {UINT32_MAX, UINT32_MAX};
* session directory structure, then we shall cleanup after ourselves.
*/
static bool destroy_job_session_dir = false;
static bool destroy_proc_session_dir = false;

static int _setup_top_session_dir(char **sdir);
static int _setup_job_session_dir(char **sdir);
Expand Down Expand Up @@ -995,9 +996,12 @@ int ompi_rte_finalize(void)
opal_process_info.top_session_dir = NULL;
}

if (NULL != opal_process_info.proc_session_dir) {
if (NULL != opal_process_info.proc_session_dir && destroy_proc_session_dir) {
opal_os_dirpath_destroy(opal_process_info.proc_session_dir,
false, check_file);
free(opal_process_info.proc_session_dir);
opal_process_info.proc_session_dir = NULL;
destroy_proc_session_dir = false;
}

if (NULL != opal_process_info.app_sizes) {
Expand Down Expand Up @@ -1174,6 +1178,7 @@ static int _setup_top_session_dir(char **sdir)

static int _setup_job_session_dir(char **sdir)
{
int rc;
/* get the effective uid */
uid_t uid = geteuid();

Expand All @@ -1185,18 +1190,34 @@ static int _setup_job_session_dir(char **sdir)
opal_process_info.job_session_dir = NULL;
return OPAL_ERR_OUT_OF_RESOURCE;
}
rc = opal_os_dirpath_create(opal_process_info.job_session_dir, 0755);
if (OPAL_SUCCESS != rc) {
// could not create session dir
free(opal_process_info.job_session_dir);
opal_process_info.job_session_dir = NULL;
return rc;
}
destroy_job_session_dir = true;
return OPAL_SUCCESS;
}

static int _setup_proc_session_dir(char **sdir)
{
int rc;

if (0 > opal_asprintf(sdir, "%s/%d",
opal_process_info.job_session_dir,
opal_process_info.my_name.vpid)) {
opal_process_info.proc_session_dir = NULL;
return OPAL_ERR_OUT_OF_RESOURCE;
}

rc = opal_os_dirpath_create(opal_process_info.proc_session_dir, 0755);
if (OPAL_SUCCESS != rc) {
// could not create session dir
free(opal_process_info.proc_session_dir);
opal_process_info.proc_session_dir = NULL;
return rc;
}
destroy_proc_session_dir = true;
return OPAL_SUCCESS;
}
Loading