Commit 5ea8b46
committed
review-comment: Synchronize access to shared network details data
Synchronize objc_get/setAssociatedObject and SentryNetwokDetailsData
locking on the NSURLSessionTask instance.
`setState` - iOS internal API, undocumented threading model
- calls captureRequestDetails
`completionHandler` - callback queue (thread) configured by app.
- calls captureResponseDetails
captureRequestDetails
To avoid introducing blocking on apple's thread, we use the lock to
objc_getAssociated(task,..) but drop the lock before processing the request
(SentryNetworkRequestDetails:setRequest).
captureResponseDetails
However we need the lock while processing response data
(SentryNetworkRequestDetails:setResponse) b/c (later) it will race with
calls to `SentryNetworkRequestDetails:serialize`. The completionHandler
is on the app's network response path, so adding some thread contention here
(worst-case) is less noticable (an i/o request just finished).1 parent f1f036a commit 5ea8b46
2 files changed
Lines changed: 42 additions & 34 deletions
File tree
- Sources
- Sentry
- Swift/Integrations/SessionReplay
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
616 | 618 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
626 | 628 | | |
627 | | - | |
| 629 | + | |
| 630 | + | |
628 | 631 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
635 | 639 | | |
636 | 640 | | |
637 | 641 | | |
| |||
642 | 646 | | |
643 | 647 | | |
644 | 648 | | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | 649 | | |
| 650 | + | |
652 | 651 | | |
653 | | - | |
654 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
655 | 661 | | |
656 | 662 | | |
657 | 663 | | |
| |||
664 | 670 | | |
665 | 671 | | |
666 | 672 | | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | 673 | | |
671 | 674 | | |
672 | 675 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
| |||
0 commit comments