Skip to content

chan_voter: List traversal in multiple threads without locking #913

@mkmer

Description

@mkmer

The client list is traversed here:

app_rpt/channels/chan_voter.c

Lines 4617 to 4622 in e98b2cc

for (client1 = clients; client1; client1 = client1->next) {
if (client1->curmaster) {
lastmaster = client1;
client1->curmaster = 0;
}
}

and here:
for (client = clients; client; client = client->next) {
if (client->nodenum != p->nodenum) {
continue;
}
if (!client->drain40ms) {
client->drainindex_40ms = client->drainindex;
client->rxseqno_40ms = client->rxseqno;
}
client->drainindex += FRAME_SIZE;
if (client->drainindex >= client->buflen) {
client->drainindex -= client->buflen;
}
client->drain40ms = !client->drain40ms;
}
}

and here:

app_rpt/channels/chan_voter.c

Lines 1637 to 1643 in 1814fa7

for (client = clients; client; client = client->next) {
if (client->nodenum != p->nodenum) {
continue;
}
if (!client->heardfrom) {
continue;
}

and:

app_rpt/channels/chan_voter.c

Lines 1811 to 1815 in 1814fa7

for (client = clients; client; client = client->next) {
if (client->nodenum != p->nodenum) {
continue;
}
if (p->priconn && !client->mix) {

(and more)

It appears there are up to 3 threads looking at the client list (and client data) that have some contention, potentially looking through a list that is revised when a client disconnects and reconnects.

Similar issue with the privates?

for (p = pvts; p; p = p->next) {

Metadata

Metadata

Assignees

Labels

chan_voterIssues related to chan_voter.socode qualityImprovments around code quality without functional changes

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions