You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.2 KiB

  1. commit 4805c249aabc45cd59386694f962e19ab50e8ca9
  2. Author: Willy Tarreau <w@1wt.eu>
  3. Date: Tue Oct 16 16:57:40 2018 +0200
  4. BUG/MEDIUM: threads: make sure threads_want_sync is marked volatile
  5. The threads_want_sync variable is not volatile, which allows the compiler
  6. to cache old copies of it for long parts of code and possibly optimize
  7. some tests away. This could result in deadlocks when using heavy queue
  8. activity or health check state changes.
  9. There is no upstream commit for this fix because the sync point was
  10. completely removed from 1.9. This fix is exclusively for 1.8.
  11. Signed-off-by: Willy Tarreau <w@1wt.eu>
  12. diff --git a/src/hathreads.c b/src/hathreads.c
  13. index 0a7c12f7..730ebee4 100644
  14. --- a/src/hathreads.c
  15. +++ b/src/hathreads.c
  16. @@ -29,7 +29,7 @@ void thread_sync_io_handler(int fd)
  17. static HA_SPINLOCK_T sync_lock;
  18. static int threads_sync_pipe[2] = {-1, -1};
  19. -static unsigned long threads_want_sync = 0;
  20. +volatile static unsigned long threads_want_sync = 0;
  21. volatile unsigned long threads_want_rdv_mask = 0;
  22. volatile unsigned long threads_harmless_mask = 0;
  23. volatile unsigned long all_threads_mask = 1; // nbthread 1 assumed by default