#35801: Signals are dispatched to receivers associated with dead senders
-------------------------------------+-------------------------------------
Reporter: bobince | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Core (Other) | Version: 5.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):
* resolution: => fixed
* status: assigned => closed
Comment:
In [changeset:"760121dcb1837fdee6ac7f4e2412c0d539fbff7a" 760121d]:
{{{#!CommitTicketReference repository=""
revision="760121dcb1837fdee6ac7f4e2412c0d539fbff7a"
Fixed #35801 -- Prevented collision of senders with non-overlapping
lifetimes.
As documented, the id() function can return the same value for distinct
objects with non-overlapping lifetimes which can result in signals being
sent to the wrong receivers if two distinct senders happen to have a
colliding id() value.
Since reproduction of the issue requires memory constrained
circumstances where the same exact id() is reused for two senders of the
same signal the test opt to simulate the collision by systematically
making the same id for Sender instances.
Note that we explicitly avoid keeping a strong reference to senders that
cannot be weakly referenced as that would unexpectedly prevent them from
being garbage collected. This means that id(sender) collisions could
still occur for such objects but Django itself doesn't make use of them.
Thanks Sjoerd Job Postmus for the reduced test case and Mariusz for the
review.
Co-authored-by: And Clover <[email protected]>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35801#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019662dcd7ee-803c08df-09fe-4072-a049-1395b18b5555-000000%40eu-central-1.amazonses.com.