Skip to content

Fix client_init() assert#116

Open
slusarz wants to merge 3 commits intodovecot:mainfrom
slusarz:client_init_assert_fix
Open

Fix client_init() assert#116
slusarz wants to merge 3 commits intodovecot:mainfrom
slusarz:client_init_assert_fix

Conversation

@slusarz
Copy link
Copy Markdown
Contributor

@slusarz slusarz commented Apr 24, 2026

No description provided.

slusarz added 2 commits April 24, 2026 14:32
If a stalled client's index is reassigned to a new connection before
the stalled client is restarted, client_init() would trigger an
assertion failure.

Fixes triggering assertion:
Panic: file client.c: line 252 (client_init): assertion failed: (idx >= array_count(&clients) || *(struct client **)array_idx(&clients, idx) == NULL)
Copy link
Copy Markdown
Contributor

@sirainen sirainen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, the first unit test, crazy stuff.

Comment thread src/client.c
int fd;

if (idx < array_count(&clients) &&
*(struct client *const *)array_idx(&clients, idx) != NULL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think array_idx_elem() != NULL to avoid *(struct client *const *)

@slusarz slusarz force-pushed the client_init_assert_fix branch from 42bdeff to c6dd6af Compare April 24, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants