[OpenSIPS-Devel] [OpenSIPS/opensips] f93870: RW locking: Add a pair of re-entrant functions for...

Liviu Chircu noreply at github.com
Thu Jan 11 14:01:49 UTC 2024


  Branch: refs/heads/3.2
  Home:   https://github.com/OpenSIPS/opensips
  Commit: f938704213276a89be815d1871308ee7a8ace275
      https://github.com/OpenSIPS/opensips/commit/f938704213276a89be815d1871308ee7a8ace275
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M rw_locking.h

  Log Message:
  -----------
  RW locking: Add a pair of re-entrant functions for readers

In some cases, the same lock_start_read() function could be reached
multiple times in a nested fashion, e.g. after running a callback which
returns the control flow to the same module through an API call done by
the module which installed the callback.


  Commit: f876dc97aebb89344bf52e7b12f810dfd99dfca6
      https://github.com/OpenSIPS/opensips/commit/f876dc97aebb89344bf52e7b12f810dfd99dfca6
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M modules/clusterer/clusterer.c
    M modules/clusterer/node_info.c
    M modules/clusterer/node_info.h

  Log Message:
  -----------
  clusterer: Fix occasional deadlock during dlg/ul sync ops

This patch fixes a possible deadlock when running the MI
`dlg_cluster_sync` or `ul_cluster_sync` functions, due to re-entrant
lock_start_read().  Deadlock example:

usleep()
clusterer_bcast_msg()
cl_send_all()              <--------------- 3. lock_start_read()
^^^ clusterer             (cannot re-acquire same lock due to writer...)
dlg_replicate_profiles()
repl_prof_remove()
destroy_linker()
remove_dlg_prof_table()
rcv_cluster_event()
^^^ dialog
handle_sync_end()
handle_sync_packet()
bin_rcv_cl_extra_packets() <--------------- 1. lock_start_read()
^^^ clusterer

usleep()
bin_rcv_cl_packets()       <--------------- 2. lock_start_write()


  Commit: a2da62740c6b68dbc21ac41607449cef302713a9
      https://github.com/OpenSIPS/opensips/commit/a2da62740c6b68dbc21ac41607449cef302713a9
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M modules/clusterer/clusterer.c
    M modules/clusterer/sync.c

  Log Message:
  -----------
  clusterer: Fix missing/extra lock ops on some error-cases


Compare: https://github.com/OpenSIPS/opensips/compare/c0ac7cf29a71...a2da62740c6b



More information about the Devel mailing list