<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">That sounds expected to me. While Array values are thread-safe, writing to the global variable 'array' from two different threads would be a race. You can see this properly diagnosed if you enable Thread Sanitizer.</div><div class=""><br class=""></div><div class="">Jordan</div><div class=""><br class=""></div><div class="">P.S. <a href="http://bugs.swift.org" class="">bugs.swift.org</a> should be back up now, if you find any other issues.</div><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 8, 2018, at 11:02, Fadi Botros via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--><div class=""><div style="background-color: rgb(255, 255, 255); font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; font-size: 13px;" class=""><div id="yui_3_16_0_ym19_1_1515413693521_4159" class="">I'm on macOS Sierra 10.12.6, and using Swift 4.0</div><div id="yui_3_16_0_ym19_1_1515413693521_4299" class="">Tried to access the array concurrently to see whether is it synchronized or no<br class=""></div><div dir="ltr" id="yui_3_16_0_ym19_1_1515413693521_4263" class=""><a href="https://pastebin.com/PnvyM3Qn" class="enhancr2_0af812e8-9a1d-3326-9334-51751140db37" id="yui_3_16_0_ym19_1_1515413693521_4262">import Foundation let global = DispatchQueue.global() var array: [Int] = [ - Pastebin.com</a><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4270" class=""><br class=""></div><div id="enhancr2_0af812e8-9a1d-3326-9334-51751140db37" class=" ymail-preserve-class ymail-preserve-style yahoo-link-enhancr-card" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="https://pastebin.com/PnvyM3Qn" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" contenteditable="false"> <a href="https://pastebin.com/PnvyM3Qn" style="text-decoration: none !important;" class="yahoo-enhancr-cardlink" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1515413693521_4318"> <table class="card-wrapper yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1515413693521_4317" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4316" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4315" class=""> <td id="yui_3_16_0_ym19_1_1515413693521_4314" width="400" class=""> <table class="card yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1515413693521_4313" cellspacing="0" cellpadding="0" border="0" width="100%"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4312" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4311" class=""> <td class="card-primary-image-cell" style="background:#000 url('https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg') no-repeat center center;background-size:cover;height:200px;position:relative;" id="yui_3_16_0_ym19_1_1515413693521_4310" bgcolor="#000000" background="https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg" valign="top"> <!--[if gte mso 9]><v:rect fill="true" stroke="false" style="width:400px;height:218px;position:absolute;top:0;left:0;"><v:fill type="frame" color="#000000" src="https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg"/></v:rect><![endif]--> <table class="yahoo-ignore-table" valign="top" style="width:100%;" id="yui_3_16_0_ym19_1_1515413693521_4309" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4308" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4307" class=""> <td style="background:transparent url('https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png') repeat left top;height:200px;" id="yui_3_16_0_ym19_1_1515413693521_4306" bgcolor="transparent" background="https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png" valign="top" class=""> <!--[if gte mso 9]><v:rect fill="true" stroke="false" style="width:400px;height:218px;position:absolute;top:-18px;left:0;"><v:fill type="pattern" color="#000000" src="https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png"/><v:textbox inset="0,0,20px,0"><![endif]--> <table class="yahoo-ignore-table" style="width:100%;height:185px;min-height:185px;" id="yui_3_16_0_ym19_1_1515413693521_4305" height="185"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4304" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4303" class=""> <td class="card-richInfo2" style="text-align:left;text-align:left;padding:15px 0 0 15px;vertical-align:top;" id="yui_3_16_0_ym19_1_1515413693521_4302"> </td> <td class="card-actions" style="text-align:right;padding:15px 15px 0 0;vertical-align:top;"> <div class="card-share-container"></div> </td> </tr> </tbody></table> <!--[if gte mso 9]></v:textbox></v:rect><![endif]--> </td> </tr> </tbody></table> </td> </tr> <tr id="yui_3_16_0_ym19_1_1515413693521_4405" class=""> <td id="yui_3_16_0_ym19_1_1515413693521_4404" class=""> <table class="card-info yahoo-ignore-table" style="background:#fff;position:relative;z-index:2;width:95%;max-width:380px;border:1px solid #e0e4e9;border-bottom:3px solid #000000;margin-top:-40px;margin-left:auto;margin-right:auto;" id="yui_3_16_0_ym19_1_1515413693521_4403" cellspacing="0" cellpadding="0" border="0" align="center"> <tbody class=""><tr class=""> <td style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;" class=""> </td> <td style="vertical-align:middle;padding:16px 12px;width:99%;" class=""> <h2 class="card-title" style="font-size: 16px; line-height:19px; margin:0 0 4px 0;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;word-break:break-word;">import Foundation let global = DispatchQueue.global() var array: [Int...</h2> <div class="card-description" style="font-size:11px;line-height:15px;color:#999;word-break:break-word;"></div> </td> <td style="text-align:right;padding:16px 12px 16px 0;" class=""> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div id="yui_3_16_0_ym19_1_1515413693521_4408" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4409" class="">When tried to run it using the terminal</div><div id="yui_3_16_0_ym19_1_1515413693521_4416" class="">This crash happened</div><div id="yui_3_16_0_ym19_1_1515413693521_4417" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4418" dir="ltr" class=""><a href="https://pastebin.com/vrdKTfrP" class="enhancr2_5a98714b-dace-156a-89c6-8e3af06f6ea3" id="yui_3_16_0_ym19_1_1515413693521_4424">swift(69836,0x700002dc2000) malloc: *** error for object 0x7ffe4be237e0: pointer - Pastebin.com</a></div><div class=""><br class=""></div><div id="enhancr2_5a98714b-dace-156a-89c6-8e3af06f6ea3" class=" ymail-preserve-class ymail-preserve-style yahoo-link-enhancr-card" style="max-width:400px;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;" data-url="https://pastebin.com/vrdKTfrP" data-type="yenhancr" data-category="article" data-embed-url="" data-size="medium" dir="ltr" contenteditable="false"> <a href="https://pastebin.com/vrdKTfrP" style="text-decoration: none !important;" class="yahoo-enhancr-cardlink" target="_blank" rel="noreferrer" id="yui_3_16_0_ym19_1_1515413693521_4442"> <table class="card-wrapper yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1515413693521_4441" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4440" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4439" class=""> <td id="yui_3_16_0_ym19_1_1515413693521_4438" width="400" class=""> <table class="card yahoo-ignore-table" style="max-width:400px;" id="yui_3_16_0_ym19_1_1515413693521_4437" cellspacing="0" cellpadding="0" border="0" width="100%"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4436" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4645" class=""> <td class="card-primary-image-cell" style="background:#000 url('https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg') no-repeat center center;background-size:cover;height:200px;position:relative;" id="yui_3_16_0_ym19_1_1515413693521_4644" bgcolor="#000000" background="https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg" valign="top"> <!--[if gte mso 9]><v:rect fill="true" stroke="false" style="width:400px;height:218px;position:absolute;top:0;left:0;"><v:fill type="frame" color="#000000" src="https://s.yimg.com/vv//api/res/1.2/x_YOsykpk_BPKDNd006jFg--~A/YXBwaWQ9bWFpbDtmaT1maWxsO2g9MjAwO3c9NDAw/https://pastebin.com/i/facebook.png.cf.jpg"/></v:rect><![endif]--> <table class="yahoo-ignore-table" valign="top" style="width:100%;" id="yui_3_16_0_ym19_1_1515413693521_4643" cellspacing="0" cellpadding="0" border="0"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4642" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4641" class=""> <td style="background:transparent url('https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png') repeat left top;height:200px;" id="yui_3_16_0_ym19_1_1515413693521_4640" bgcolor="transparent" background="https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png" valign="top" class=""> <!--[if gte mso 9]><v:rect fill="true" stroke="false" style="width:400px;height:218px;position:absolute;top:-18px;left:0;"><v:fill type="pattern" color="#000000" src="https://s.yimg.com/nq/storm/assets/enhancrV2/12/overlay-tile.png"/><v:textbox inset="0,0,20px,0"><![endif]--> <table class="yahoo-ignore-table" style="width:100%;height:185px;min-height:185px;" id="yui_3_16_0_ym19_1_1515413693521_4639" height="185"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4638" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4637" class=""> <td class="card-richInfo2" style="text-align:left;text-align:left;padding:15px 0 0 15px;vertical-align:top;" id="yui_3_16_0_ym19_1_1515413693521_4636"> </td> <td class="card-actions" style="text-align:right;padding:15px 15px 0 0;vertical-align:top;"> <div class="card-share-container"></div> </td> </tr> </tbody></table> <!--[if gte mso 9]></v:textbox></v:rect><![endif]--> </td> </tr> </tbody></table> </td> </tr> <tr id="yui_3_16_0_ym19_1_1515413693521_4435" class=""> <td id="yui_3_16_0_ym19_1_1515413693521_4434" class=""> <table class="card-info yahoo-ignore-table" style="background:#fff;position:relative;z-index:2;width:95%;max-width:380px;border:1px solid #e0e4e9;border-bottom:3px solid #000000;margin-top:-40px;margin-left:auto;margin-right:auto;" id="yui_3_16_0_ym19_1_1515413693521_4433" cellspacing="0" cellpadding="0" border="0" align="center"> <tbody id="yui_3_16_0_ym19_1_1515413693521_4491" class=""><tr id="yui_3_16_0_ym19_1_1515413693521_4490" class=""> <td style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;" class=""> </td> <td style="vertical-align:middle;padding:16px 12px;width:99%;" id="yui_3_16_0_ym19_1_1515413693521_4489" class=""> <h2 class="card-title" style="font-size: 16px; line-height:19px; margin:0 0 4px 0;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;word-break:break-word;">swift(69836,0x700002dc2000) malloc: *** error for object 0x7ffe4be237e0: po...</h2> <div class="card-description" style="font-size:11px;line-height:15px;color:#999;word-break:break-word;"></div> </td> <td style="text-align:right;padding:16px 12px 16px 0;" class=""> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </a></div><div id="yui_3_16_0_ym19_1_1515413693521_4432" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4484" class="">Avoided this crash using Serial Dispatch Queue</div><div id="yui_3_16_0_ym19_1_1515413693521_4485" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4488" dir="ltr" class="">let otherDispatch = DispatchQueue(label: "<a href="http://another.dispatch.com" class="">another.dispatch.com</a>",<br id="yui_3_16_0_ym19_1_1515413693521_4600" class=""> qos: .default)<br id="yui_3_16_0_ym19_1_1515413693521_4601" class="">func appending(_ i: Int) {<br id="yui_3_16_0_ym19_1_1515413693521_4602" class=""> otherDispatch.sync { array.append(i) }<br id="yui_3_16_0_ym19_1_1515413693521_4603" class="">}<br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4523" class=""><br class=""></div><div id="yui_3_16_0_ym19_1_1515413693521_4530" class=""><br class=""></div><div dir="ltr" id="yui_3_16_0_ym19_1_1515413693521_4460" class=""><br class=""></div><div dir="ltr" id="yui_3_16_0_ym19_1_1515413693521_4687" class="">Also tried to file this issue on <a href="http://bugs.swift.org" class="">bugs.swift.org</a>, and it appears your site is down (under maintainence)</div><div dir="ltr" id="yui_3_16_0_ym19_1_1515413693521_4691" class=""><br class=""></div><div dir="ltr" class="">Sorry<br class=""></div></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></body></html>