Fix a threading-related crash in privacy consent recalculation.

Review Request #13322 — Created Oct. 9, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

Under certain conditions, we recompute the privacy consent
registrations. This can happen on thread startup or teardown, and
occasionally, two threads end up interfering with each other's state.

This happens because, when recomputing, an unregister is performed, and
on a blank registry this will trigger a registry population, which then
triggers a signal and another attempt at a recomputation, in the middle
of an existing one. If this happens in multiple threads, it compounds
the problem.

When this happens, we can end up triggering a double register of the new
consent requirements, which will crash.

We now surround all this with a threading lock, and check for this in
the signal handler to avoid triggering an extra recomputation.

Unit tests pass.

Consent requirements continue to work properly.

Summary ID
Fix a threading-related crash in privacy consent recalculation.
Under certain conditions, we recompute the privacy consent registrations. This can happen on thread startup or teardown, and occasionally, two threads end up interfering with each other's state. This happens because, when recomputing, an unregister is performed, and on a blank registry this will trigger a registry population, which then triggers a signal and another attempt at a recomputation, in the middle of an existing one. If this happens in multiple threads, it compounds the problem. When this happens, we can end up triggering a double register of the new consent requirements, which will crash. We now surround all this with a threading lock, and check for this in the signal handler to avoid triggering an extra recomputation.
5691f304cf9c6161b63529ec1906fc30924a5a92
Description From Last Updated

Blank line between these two.

daviddavid
david
  1. 
      
  2. reviewboard/accounts/privacy.py (Diff revision 1)
     
     
     

    Blank line between these two.

    1. Oops, the assert was leftover debugging. I'll remove it.

  3. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (fb9ddfe)
Loading...