<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Thanks Kuba! I have a PR already that adds a lock around the task, which seems to make the sanitizer happy.&nbsp;</div><div><br></div><div><br></div><div><br></div><div>Jon</div><div><br>On Jul 6, 2017, at 11:39 AM, Kuba Mracek &lt;<a href="mailto:mracek@apple.com">mracek@apple.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Looks like a real race. &nbsp;It seems irrelevant whether it's run under Swift 3.2 or Swift 4 mode, but TSan only detects the issue sometimes. &nbsp;Most likely that's either because:<div class=""><br class=""></div><div class="">1) the order of the async callbacks (via&nbsp;<span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">DispatchQueue</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">.</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(79, 129, 135);" class="">utility</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">.</span><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(62, 30, 129);" class="">async</span>, etc.) can be "okay" in some program runs, or</div><div class="">2) the racy accesses just happen to be done on the same thread (even when they're on different queues).</div><div class=""><br class=""></div><div class="">In any case, the SessionManager.retry method seems to be modifying the request and that's not synchronized with the main thread using the request. &nbsp;Again, looks like a real race that needs fixing.</div><div class=""><br class=""></div><div class="">Kuba<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 2 Jul 2017, at 16:53, Jon Shier &lt;<a href="mailto:jon@jonshier.com" class="">jon@jonshier.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Investigating this now more thoroughly and it appears my initial concern was wrong, as it’s detected the threading issues in Swift 3.2 mode as well. I’m not sure whether this was an Xcode 9b1 issue, a product of switching the Swift version back and forth while make Alamofire compatible with Swift 3.2 and 4 or what, but the issue does appear now in both 3.2 and 4. I’m tracking the issue in&nbsp;<a href="https://github.com/Alamofire/Alamofire/issues/2189" class="">https://github.com/Alamofire/Alamofire/issues/2189</a>&nbsp;but it seems to be a legit issue. Thanks!<div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Jon<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jun 26, 2017, at 1:54 PM, Joe Groff &lt;<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Jun 26, 2017, at 10:33 AM, Joe Groff via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 25, 2017, at 3:56 PM, Jon Shier via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Running Alamofire through the thread sanitizer and the thread sanitizer finds issues in Swift 4 mode but not Swift 3.2. Does Swift 4 add additional threading instrumentation that you don’t get under other versions? Or is there some other runtime difference that explains it?<br class=""></blockquote><br class="">Would you be able to file bugs for specific issues so we can investigate whether the behavior changes are intentional?<br class=""></blockquote><br class="">cc'ing Anna, Devin, and Kuba who worked on improving TSan support for Swift.<br class=""><br class="">-Joe</div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote></body></html>