Ryan Petrello e45e4b3cda
fix a deadlock when Python garbage collects LDAPBackend objects
we shouldn't call signal.disconnect in __del__ because it can lead to
deadlocks in Django signal dispatch code

The Signal.connect, Signal.disconnect, and Signal._live_receivers
methods all share a threading.Lock():

22a60f8d0b/django/dispatch/dispatcher.py (L49)

It's possible for this to lead to a deadlock:

1.  Have code that calls Signal._live_receivers and enter the critical
    path inside the shared threading.Lock()
2.  Python garbage collection occurs and finds one or more LDAPBackend
    objects with no more references
3.  This __del__ is called, which calls Signal.disconnect
4.  Code in Signal._disconnect attempts to obtain the (already held)
    threading.Lock
5.  Python hangs forever while attempting to garbage collect
2019-01-18 11:27:50 -05:00
..
2019-01-15 14:09:01 -05:00
2019-01-15 14:09:01 -05:00
2019-01-15 14:09:05 -05:00
2016-09-26 22:14:47 -04:00
2019-01-15 14:09:01 -05:00
2019-01-15 14:09:01 -05:00
2019-01-15 14:09:01 -05:00
2017-11-10 17:04:33 -05:00
2019-01-15 14:09:01 -05:00