<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">In the process of debugging a bunch of consistent failures in TestFoundation/TestNSURLSession, I came across a weird problem symptom in <a target="_blank" href="https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSURLSession/NSURLSessionTask.swift#L329" title="https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSURLSession/NSURLSessionTask.swift#L329">this line of code</a>.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><span style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#24292e">internalState </font></span><span class="pl-k" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#a71d5d">=</font></span><span style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#24292e"> .</font></span><span class="pl-c1" style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#0086b3">transferInProgress</font></span><span style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#24292e">(transferState)</font></span><br></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><span style="font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; white-space: pre;"><font color="#24292e"><br></font></span></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">I had a suspicion that the above modification is not taking effect, since, only based on this change the didSet observer for the `internalState` property triggers data transfers using libcurl. So, I simply printed the property before and after the assignment.&nbsp;</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div><font face="monospace, Courier New, Courier, monospace" size="2">print("before =&gt; \(internalState)")</font></div><div><font face="monospace, Courier New, Courier, monospace" size="2"><span style="white-space: pre;"><font color="#24292e">internalState </font></span><span class="pl-k" style="box-sizing: border-box; white-space: pre;"><font color="#a71d5d">=</font></span><span style="white-space: pre;"><font color="#24292e"> .</font></span><span class="pl-c1" style="box-sizing: border-box; white-space: pre;"><font color="#0086b3">transferInProgress</font></span><span style="white-space: pre;"><font color="#24292e">(transferState)</font></span><br></font></div><div><p style="margin: 0px; line-height: normal;"><span style="font-variant-ligatures: no-common-ligatures;"><font face="monospace, Courier New, Courier, monospace" size="2">print("after =&gt; \(internalState)")</font></span></p><p style="margin: 0px; line-height: normal;"><span style="font-variant-ligatures: no-common-ligatures;"><font face="monospace, Courier New, Courier, monospace" size="2"><br></font></span></p></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">Surprisingly, I don't see any change in the property value:</div><div><font face="monospace, Courier New, Courier, monospace" size="2" color="#0000ff">before =&gt; transferReady(Foundation.URLSessionTask._TransferState(... &lt;redacted&gt; ...))<br></font></div><div><p style="margin: 0px; line-height: normal;"><span style="font-variant-ligatures: no-common-ligatures;"><font face="monospace, Courier New, Courier, monospace" size="2" color="#0000ff">after &nbsp;=&gt; transferReady(Foundation.URLSessionTask._TransferState(... &lt;redacted&gt; ...))</font></span></p></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></div><div><font face="Verdana, Arial, Helvetica, sans-serif" style="font-size: small;">When I switched back to the "</font><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif" size="2">swift-DEVELOPMENT-SNAPSHOT-2017-04-24-a"</font><span style="font-size: 14px; font-family: Menlo;">&nbsp;</span><font face="Verdana, Arial, Helvetica, sans-serif" style="font-size: small;">tag on all the repos (except swift-corelibs-foundation), I do not see this problem. I see:</font></div><div><p style="margin: 0px; line-height: normal;"><span style="font-variant-ligatures: no-common-ligatures;"><font face="monospace, Courier New, Courier, monospace" size="2" color="#0000ff">before =&gt; transferReady(Foundation.URLSessionTask._TransferState(... &lt;redacted&gt; ...))</font></span></p><p style="margin: 0px; line-height: normal;"><span style="font-variant-ligatures: no-common-ligatures;"><font face="monospace, Courier New, Courier, monospace" size="2" color="#0000ff">after &nbsp;=&gt; transferInProgress(Foundation.URLSessionTask._TransferState(... &lt;redacted&gt; ...))</font></span></p><p style="font-family: Menlo; font-size: 14px; margin: 0px; line-height: normal;"><br></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">To put it in simple terms, the modification doesn't seem to be taking effect with the current HEAD.&nbsp;</span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">I haven't been able to isolate this problem in an independent test case. However, anybody who wants to reproduce it can simply run TestFoundation after enabling the URLSession tests (which have been disabled for now) in TestFoundation/main.swift.&nbsp;</span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">I did compare the `-emit-ir` outputs from the passing and failing levels. There seems to be a clear difference in the way we store the new value of this property. But given my limited exposure to debugging Swift compiler issues, I wasn't able to progress further. &nbsp;</span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">&nbsp;</span><br></p><p style="margin: 0px; line-height: normal;"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Can someone help us here please? Thanks.&nbsp;</font></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><br></span></p><p style="margin: 0px; line-height: normal;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;">Pushkar N Kulkarni,</span><br></p></div><div><font><font><font><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr"><div class="socmaildefaultfont" dir="ltr">
<div dir="ltr" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif">IBM Runtimes</font></div><div dir="ltr" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; font-style: normal;"><font face="Sans Serif, Verdana, Arial, Helvetica, sans-serif"><br></font></div><div dir="ltr" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small;"><font face="serif, Times New Roman, Times, serif"><i>Simplicity is prerequisite for reliability - Edsger W. Dijkstra</i></font></div>
<div dir="ltr" style="font-family: Arial; font-size: 10.5pt; font-style: normal;"><br></div></div></div></div></font></font></font></div></font><BR>