Skip to content

Commit 1343943

Browse files
committed
flux-shell: use f58plain in shell service name
Problem: the job-exec module reconstructs the shell's service name to send the rank 0 shell an exception message when one of the other shells goes offline, but when f58 encoding is used, the reconstruction could be different when the shell node and the rank 0 node have different locale configurations. Use the f58plain jobid encoding to avoid this potential mismatch. Fixes #5257
1 parent 1ad6918 commit 1343943

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/modules/job-exec/job-exec.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,14 @@ flux_future_t *jobinfo_shell_rpc_pack (struct jobinfo *job,
171171
char *shell_topic = NULL;
172172
flux_future_t *f = NULL;
173173
uint32_t rank;
174-
175-
if (asprintf (&shell_topic,
176-
"%ju-shell-%s.%s",
177-
(uintmax_t) job->userid,
178-
idf58 (job->id),
179-
topic) < 0
174+
char idbuf[21];
175+
176+
if (flux_job_id_encode (job->id, "f58plain", idbuf, sizeof (idbuf)) < 0
177+
|| asprintf (&shell_topic,
178+
"%ju-shell-%s.%s",
179+
(uintmax_t) job->userid,
180+
idbuf,
181+
topic) < 0
180182
|| ((rank = resource_set_nth_rank (job->R, 0)) == IDSET_INVALID_ID))
181183
goto out;
182184
va_start (ap, fmt);

src/shell/svc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,25 @@ static int lookup_rank (struct shell_svc *svc, int shell_rank, int *rank)
6161
return 0;
6262
}
6363

64+
/* Avoid locale-specific encoding for the shell service name.
65+
* See flux-framework/flux-core#5257.
66+
*/
6467
static int build_topic (struct shell_svc *svc,
6568
const char *method,
6669
char *buf,
6770
int len)
6871
{
72+
char idbuf[21];
73+
if (flux_job_id_encode (svc->shell->info->jobid,
74+
"f58plain",
75+
idbuf,
76+
sizeof (idbuf)) < 0)
77+
return -1;
6978
if (snprintf (buf,
7079
len,
7180
"%ju-shell-%s%s%s",
7281
(uintmax_t)svc->uid,
73-
idf58 (svc->shell->info->jobid),
82+
idbuf,
7483
method ? "." : "",
7584
method ? method : "") >= len) {
7685
errno = EINVAL;

0 commit comments

Comments
 (0)