]> git.ipfire.org Git - thirdparty/bird.git/commit
Table: fix a race condition in export
authorMaria Matejka <mq@ucw.cz>
Fri, 23 May 2025 17:17:53 +0000 (19:17 +0200)
committerMaria Matejka <mq@ucw.cz>
Sun, 25 May 2025 19:02:51 +0000 (21:02 +0200)
commit63df4dcf76f01b0b3f3447a012553a9ea39f8782
tree157e6244cd5c1f5776ca7927d6ff99a7fe2cbdda
parent6e02f72562b2b953fbcdd60d1de035fb313cf9e8
Table: fix a race condition in export

The race condition happens as follows:

- channel A starts feeding
- channel B imports a route ahead of the feeding pointer
- channel A exports this route and continues feeding from the pointer
- no other import hits this specific prefix
- there is at least one channel C which has not cleared this export
- channel A computes ecnt=0 for this prefix because all exports
  have been already cleared
- the condition e >= ecnt mistakenly triggers retry

If the birdloops involved get assigned to the same thread, this race
condition then can't recover and the thread is stuck in an infinite
loop.

Fixed the race condition by moving the consistency check after actually
checking eligibility of the export, not before.

Found by randomly observing performance tests.
nest/rt-table.c