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.

54 lines
2.3 KiB

  1. commit a3cfe8f4bc2ec98fdbe25c49f2c21699b6d09d2b
  2. Author: Christopher Faulet <cfaulet@haproxy.com>
  3. Date: Mon Mar 18 13:57:42 2019 +0100
  4. BUG/MAJOR: spoe: Fix initialization of thread-dependent fields
  5. A bug was introduced in the commit b0769b ("BUG/MEDIUM: spoe: initialization
  6. depending on nbthread must be done last"). The code depending on global.nbthread
  7. was moved from cfg_parse_spoe_agent() to spoe_check() but the pointer on the
  8. agent configuration was not updated to use the filter's one. The variable
  9. curagent is a global variable only valid during the configuration parsing. In
  10. spoe_check(), conf->agent must be used instead.
  11. This patch must be backported to 1.9 and 1.8.
  12. (cherry picked from commit fe261551b9980fe33990eb34d2153bf1de24b20f)
  13. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  14. (cherry picked from commit 7a93d271d549144a8ed8c816f5694a51ab62b90c)
  15. Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
  16. diff --git a/src/flt_spoe.c b/src/flt_spoe.c
  17. index e4453882..66d26f34 100644
  18. --- a/src/flt_spoe.c
  19. +++ b/src/flt_spoe.c
  20. @@ -2937,20 +2937,20 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
  21. if (global.nbthread == 1)
  22. conf->agent->flags |= SPOE_FL_ASYNC;
  23. - if ((curagent->rt = calloc(global.nbthread, sizeof(*curagent->rt))) == NULL) {
  24. + if ((conf->agent->rt = calloc(global.nbthread, sizeof(*conf->agent->rt))) == NULL) {
  25. ha_alert("Proxy %s : out of memory initializing SPOE agent '%s' declared at %s:%d.\n",
  26. px->id, conf->agent->id, conf->agent->conf.file, conf->agent->conf.line);
  27. return 1;
  28. }
  29. for (i = 0; i < global.nbthread; ++i) {
  30. - curagent->rt[i].frame_size = curagent->max_frame_size;
  31. - curagent->rt[i].applets_act = 0;
  32. - curagent->rt[i].applets_idle = 0;
  33. - curagent->rt[i].sending_rate = 0;
  34. - LIST_INIT(&curagent->rt[i].applets);
  35. - LIST_INIT(&curagent->rt[i].sending_queue);
  36. - LIST_INIT(&curagent->rt[i].waiting_queue);
  37. - HA_SPIN_INIT(&curagent->rt[i].lock);
  38. + conf->agent->rt[i].frame_size = conf->agent->max_frame_size;
  39. + conf->agent->rt[i].applets_act = 0;
  40. + conf->agent->rt[i].applets_idle = 0;
  41. + conf->agent->rt[i].sending_rate = 0;
  42. + LIST_INIT(&conf->agent->rt[i].applets);
  43. + LIST_INIT(&conf->agent->rt[i].sending_queue);
  44. + LIST_INIT(&conf->agent->rt[i].waiting_queue);
  45. + HA_SPIN_INIT(&conf->agent->rt[i].lock);
  46. }
  47. free(conf->agent->b.name);