[vlc-devel] [PATCH v6 3/7] upnp: Split s_lock into two locks to solve deadlock issue
Rémi Denis-Courmont
remi at remlab.net
Wed Dec 4 21:56:01 CET 2019
Le keskiviikkona 4. joulukuuta 2019, 22.39.59 EET Johan Gunnarsson a écrit :
> If libupnp executes a callback while vlc runs UpnpInstanceWrapper dtor, vlc
> will deadlock. This happens because the callback handler and
> UpnpInstanceWrapper dtor both takes s_lock, and Upnp_Finish waits for all
> callbacks to finish. UpnpUnRegisterRootDevice causes libupnp to broadcast
> "byebye" advertisements, which libupnp picks up again and delivers as
> callbacks.
>
> This patch separates the locks into one that protects the
> UpnpInstanceWrapper refcounts and one that protects the list of listeners.
AFAICT, an UPnP instance as a whole is not thread-safe, so you cannot split
locks without inducing races inside the library.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list