]> 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 17:21:26 +0000 (19:21 +0200)
commit127107e67a1b25b944ae080e84a28168ee2bcca7
tree8149051cedd54715f69344b05c411a2e71d3cb95
parent728ee5f79730de7a7e036ebcea1d883487fe54e2
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