title: Swift async functions with Task.sleep in it causes segmentation fault
body: <p>I'm learning Swift concurrency now, and I've written some code to have a try on it. I've expected the &quot;photo&quot; with greater id to be &quot;downloaded&quot; earlier.</p>
  <pre class="lang-swift prettyprint-override"><code>func downloadPhoto(id: Int) async -&gt; String {
      print(&quot;Download started&quot;)
  
      let total = 3
      try! await Task.sleep(nanoseconds: UInt64(total - id) * 1_000_000_000)
  
      print(&quot;Download ended&quot;)
  
      let str = &quot;Photo \(id)&quot;
      print(str + &quot; downloaded&quot;)
      return str
  }
  Task{
      print(&quot;Program started&quot;)
  
      async let firstPhoto = downloadPhoto(id: 0)
      async let secondPhoto = downloadPhoto(id: 1)
      async let thirdPhoto = downloadPhoto(id: 2)
  
      let photos = await [firstPhoto, secondPhoto, thirdPhoto]
  
      print(photos)
  }
  </code></pre>
  <p>However, when I saved the code to <code>test.swift</code> and run it with <code>swift test.swift</code>, I got the following output:</p>
  <pre><code>Program started
  Download started
  Download started
  Download started
  </code></pre>
  <p>That is, none of the code after <code>Task.sleep</code> executed. To find out what's going wrong, I changed</p>
  <pre><code>try! await Task.sleep(nanoseconds: UInt64(total - id) * 1_000_000_000)
  </code></pre>
  <p>to</p>
  <pre><code>try! await Task.sleep(nanoseconds: 3)
  </code></pre>
  <p>and this time I got the expected output,</p>
  <pre><code>Program started
  Download started
  Download started
  Download started
  Download ended
  Download ended
  Photo 1 downloaded
  Download ended
  Photo 2 downloaded
  Photo 0 downloaded
  [&quot;Photo 0&quot;, &quot;Photo 1&quot;, &quot;Photo 2&quot;]
  </code></pre>
  <p>Then, I changed the parameter <code>3</code> to <code>300000</code> and ran again. This time I got</p>
  <pre><code>Program started
  Download started
  Download started
  Download started
  Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
  zsh: segmentation fault  swift test.swift
  </code></pre>
  <p>I don't know why the first version doesn't yield a segmentation fault message, nor do I know why there is a segmentation fault. Seems that once the time to sleep grows large enough to some degree the segmentation fault occurs.</p>
  <p>Here is the crash log:</p>
  <pre><code>-------------------------------------
  Translated Report (Full Report Below)
  -------------------------------------
  
  Process:               swift-frontend [72033]
  Path:                  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend
  Identifier:            swift-frontend
  Version:               ???
  Code Type:             ARM-64 (Native)
  Parent Process:        zsh [70066]
  Responsible:           Terminal [70064]
  User ID:               501
  
  Date/Time:             2022-02-17 00:08:58.2001 +0800
  OS Version:            macOS 12.2.1 (21D62)
  Report Version:        12
  Anonymous UUID:        7B963A0A-2299-D9C6-8085-A5F2F172ABC9
  
  Sleep/Wake UUID:       A1819DA4-A7E6-453F-AC28-5B0CD7C84E42
  
  Time Awake Since Boot: 330000 seconds
  Time Since Wake:       2804 seconds
  
  System Integrity Protection: enabled
  
  Crashed Thread:        1  Dispatch queue: com.apple.root.user-initiated-qos.cooperative
  
  Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
  Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000108364208
  Exception Codes:       0x0000000000000001, 0x0000000108364208
  Exception Note:        EXC_CORPSE_NOTIFY
  
  VM Region Info: 0x108364208 is not in any region.  Bytes after previous region: 521  Bytes before following region: 581549560
        REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
        mapped file                 108330000-108364000    [  208K] r--/r-- SM=COW  ...t_id=be3988bd
  ---&gt;  GAP OF 0x22a9c000 BYTES
        MALLOC_TINY                 12ae00000-12af00000    [ 1024K] rw-/rwx SM=PRV  
  
  Thread 0::  Dispatch queue: com.apple.main-thread
  0   libsystem_malloc.dylib                 0x1a7698e18 szone_free_definite_size + 240
  1   swift-frontend                         0x101db5258 swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass() + 408
  2   swift-frontend                         0x101db5258 swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass() + 408
  3   swift-frontend                         0x101d91950 swift::GenericSignatureBuilder::Implementation::~Implementation() + 392
  4   swift-frontend                         0x101bfa0c4 swift::ASTContext::Implementation::Arena::~Arena() + 716
  5   swift-frontend                         0x101bdafb4 swift::ASTContext::~ASTContext() + 288
  6   swift-frontend                         0x100e9fd5c swift::CompilerInstance::~CompilerInstance() + 316
  7   swift-frontend                         0x100d685b4 swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 2488
  8   swift-frontend                         0x100cc2df8 main + 932
  9   dyld                                   0x1072910f4 start + 520
  
  Thread 1 Crashed::  Dispatch queue: com.apple.root.user-initiated-qos.cooperative
  0   ???                                    0x108364208 ???
  1   libswift_Concurrency.dylib             0x2257fb7b0 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 76
  2   libdispatch.dylib                      0x1a76d431c _dispatch_root_queue_drain + 396
  3   libdispatch.dylib                      0x1a76d4b58 _dispatch_worker_thread2 + 164
  4   libsystem_pthread.dylib                0x1a787d2c8 _pthread_wqthread + 228
  5   libsystem_pthread.dylib                0x1a787c018 start_wqthread + 8
  
  Thread 2::  Dispatch queue: com.apple.root.user-initiated-qos.cooperative
  0   libsystem_kernel.dylib                 0x1a78463a8 access + 8
  1   swift-frontend                         0x104ff2dac llvm::sys::fs::access(llvm::Twine const&amp;, llvm::sys::fs::AccessMode) + 84
  2   swift-frontend                         0x104ff6120 llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef&lt;llvm::StringRef&gt;) + 416
  3   swift-frontend                         0x104ff6ea8 printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&amp;) + 588
  4   swift-frontend                         0x104ff79f0 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) + 100
  5   swift-frontend                         0x104ff6acc llvm::sys::RunSignalHandlers() + 128
  6   swift-frontend                         0x104ff8004 SignalHandler(int) + 292
  7   libsystem_platform.dylib               0x1a78984e4 _sigtramp + 56
  8   libswift_Concurrency.dylib             0x2257fad6c swift::runJobInEstablishedExecutorContext(swift::Job*) + 280
  9   libswift_Concurrency.dylib             0x2257fb7b0 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 76
  10  libdispatch.dylib                      0x1a76d431c _dispatch_root_queue_drain + 396
  11  libdispatch.dylib                      0x1a76d4b58 _dispatch_worker_thread2 + 164
  12  libsystem_pthread.dylib                0x1a787d2c8 _pthread_wqthread + 228
  13  libsystem_pthread.dylib                0x1a787c018 start_wqthread + 8
  
  Thread 3::  Dispatch queue: com.apple.root.user-initiated-qos.cooperative
  0   ???                                    0x108364208 ???
  1   libswift_Concurrency.dylib             0x2257fb7b0 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 76
  2   libdispatch.dylib                      0x1a76d431c _dispatch_root_queue_drain + 396
  3   libdispatch.dylib                      0x1a76d4b58 _dispatch_worker_thread2 + 164
  4   libsystem_pthread.dylib                0x1a787d2c8 _pthread_wqthread + 228
  5   libsystem_pthread.dylib                0x1a787c018 start_wqthread + 8
  
  Thread 4:
  0   libsystem_pthread.dylib                0x1a787c010 start_wqthread + 0
  
  
  Thread 1 crashed with ARM Thread State (64-bit):
      x0: 0x0000000108364208   x1: 0x000000010720b200   x2: 0x000000013af06e90   x3: 0x0000000000000001
      x4: 0x000000000000000e   x5: 0x0000000000000001   x6: 0x0000000000000000   x7: 0x0000000000000000
      x8: 0x000000013b8f3c98   x9: 0x000000000000290b  x10: 0x00000000000efc50  x11: 0x0000000000179f41
     x12: 0x000000013af00000  x13: 0x0000000000000000  x14: 0x000000005d61b963  x15: 0x000000000000bb0a
     x16: 0x000000066f80f7b4  x17: 0x0000000108364208  x18: 0x0000000000000000  x19: 0x000000013b8ecb90
     x20: 0x0000000000000000  x21: 0x000000013b8f4040  x22: 0x000000013b8f3c90  x23: 0x000000016f1db0e0
     x24: 0x000000013b8ecb90  x25: 0x0000000000000000  x26: 0x0000000232b23e38  x27: 0x0000000000000000
     x28: 0x000000016f1db0e0   fp: 0x000000016f1dae90   lr: 0x00000002257fad6c
      sp: 0x000000016f1dae60   pc: 0x0000000108364208 cpsr: 0x60001000
     far: 0x0000000108364208  esr: 0x82000007 (Instruction Abort) Translation fault
  
  Binary Images:
         0x1a7694000 -        0x1a76befff libsystem_malloc.dylib (*) &lt;961751ed-f18b-30d4-8025-aa12ca23197b&gt; /usr/lib/system/libsystem_malloc.dylib
         0x100cac000 -        0x105e23fff swift-frontend (*) &lt;a80c4d84-e9ff-3e38-8e35-666b1f91f585&gt; /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend
         0x10728c000 -        0x1072ebfff dyld (*) &lt;d21a73ea-79cd-36eb-8ac9-2c5cf5181a27&gt; /usr/lib/dyld
                 0x0 - 0xffffffffffffffff ??? (*) &lt;00000000-0000-0000-0000-000000000000&gt; ???
         0x2257bd000 -        0x225810fff libswift_Concurrency.dylib (*) &lt;50b9f80c-f39b-3792-b642-1ff1684a50b3&gt; /usr/lib/swift/libswift_Concurrency.dylib
         0x1a76bf000 -        0x1a7705fff libdispatch.dylib (*) &lt;93e1dcfc-ef56-3113-8e7c-1ba85266a93b&gt; /usr/lib/system/libdispatch.dylib
         0x1a787a000 -        0x1a7886fff libsystem_pthread.dylib (*) &lt;f7b2eccf-e6f1-3109-ae81-9028c0b8332a&gt; /usr/lib/system/libsystem_pthread.dylib
         0x1a7844000 -        0x1a7879fff libsystem_kernel.dylib (*) &lt;384945e6-dd71-37e5-9a3d-84fff14a1e60&gt; /usr/lib/system/libsystem_kernel.dylib
         0x1a7894000 -        0x1a789bfff libsystem_platform.dylib (*) &lt;49cf1536-27e5-3a34-9724-d75552cbab56&gt; /usr/lib/system/libsystem_platform.dylib
  
  External Modification Summary:
    Calls made by other processes targeting this process:
      task_for_pid: 0
      thread_create: 0
      thread_set_state: 0
    Calls made by this process:
      task_for_pid: 0
      thread_create: 0
      thread_set_state: 0
    Calls made by all processes on this machine:
      task_for_pid: 40
      thread_create: 0
      thread_set_state: 2506
  
  VM Region Summary:
  ReadOnly portion of Libraries: Total=684.4M resident=0K(0%) swapped_out_or_unallocated=684.4M(100%)
  Writable regions: Total=813.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=813.9M(100%)
  
                                  VIRTUAL   REGION 
  REGION TYPE                        SIZE    COUNT (non-coalesced) 
  ===========                     =======  ======= 
  Activity Tracing                   256K        1 
  Kernel Alloc Once                   32K        1 
  MALLOC                           179.2M       18 
  MALLOC guard page                   96K        5 
  MALLOC_MEDIUM (reserved)         240.0M        2         reserved VM address space (unallocated)
  MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
  STACK GUARD                       56.1M        5 
  Stack                             10.1M        5 
  VM_ALLOCATE                        1.0G        1 
  VM_ALLOCATE (reserved)             256K        1         reserved VM address space (unallocated)
  __AUTH                             112K       14 
  __AUTH_CONST                       219K       44 
  __DATA                             765K       43 
  __DATA_CONST                      4898K       46 
  __DATA_DIRTY                       164K       23 
  __LINKEDIT                       590.7M        3 
  __OBJC_CONST                        12K        6 
  __OBJC_RO                         82.1M        1 
  __OBJC_RW                         3104K        1 
  __TEXT                            93.6M       49 
  dyld private memory               1024K        1 
  mapped file                       14.9M        5 
  shared memory                       32K        2 
  ===========                     =======  ======= 
  TOTAL                              2.6G      278 
  TOTAL, minus reserved VM space     2.0G      278 
  
  
  
  -----------
  Full Report
  -----------
  
  {&quot;app_name&quot;:&quot;swift-frontend&quot;,&quot;timestamp&quot;:&quot;2022-02-17 00:08:58.00 +0800&quot;,&quot;app_version&quot;:&quot;&quot;,&quot;slice_uuid&quot;:&quot;a80c4d84-e9ff-3e38-8e35-666b1f91f585&quot;,&quot;build_version&quot;:&quot;&quot;,&quot;platform&quot;:1,&quot;share_with_app_devs&quot;:1,&quot;is_first_party&quot;:1,&quot;bug_type&quot;:&quot;309&quot;,&quot;os_version&quot;:&quot;macOS 12.2.1 (21D62)&quot;,&quot;incident_id&quot;:&quot;269117E0-1DFC-40A1-B7CF-5AEFE9FCF4D7&quot;,&quot;name&quot;:&quot;swift-frontend&quot;}
  {
    &quot;uptime&quot; : 330000,
    &quot;procLaunch&quot; : &quot;2022-02-17 00:08:58.0437 +0800&quot;,
    &quot;procRole&quot; : &quot;Unspecified&quot;,
    &quot;version&quot; : 2,
    &quot;userID&quot; : 501,
    &quot;deployVersion&quot; : 210,
    &quot;modelCode&quot; : &quot;MacBookPro17,1&quot;,
    &quot;procStartAbsTime&quot; : 7991622767392,
    &quot;coalitionID&quot; : 14494,
    &quot;osVersion&quot; : {
      &quot;train&quot; : &quot;macOS 12.2.1&quot;,
      &quot;build&quot; : &quot;21D62&quot;,
      &quot;releaseType&quot; : &quot;User&quot;
    },
    &quot;captureTime&quot; : &quot;2022-02-17 00:08:58.2001 +0800&quot;,
    &quot;incident&quot; : &quot;269117E0-1DFC-40A1-B7CF-5AEFE9FCF4D7&quot;,
    &quot;bug_type&quot; : &quot;309&quot;,
    &quot;pid&quot; : 72033,
    &quot;procExitAbsTime&quot; : 7991626514464,
    &quot;translated&quot; : false,
    &quot;cpuType&quot; : &quot;ARM-64&quot;,
    &quot;procName&quot; : &quot;swift-frontend&quot;,
    &quot;procPath&quot; : &quot;\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift-frontend&quot;,
    &quot;parentProc&quot; : &quot;zsh&quot;,
    &quot;parentPid&quot; : 70066,
    &quot;coalitionName&quot; : &quot;com.apple.Terminal&quot;,
    &quot;crashReporterKey&quot; : &quot;7B963A0A-2299-D9C6-8085-A5F2F172ABC9&quot;,
    &quot;responsiblePid&quot; : 70064,
    &quot;responsibleProc&quot; : &quot;Terminal&quot;,
    &quot;wakeTime&quot; : 2804,
    &quot;sleepWakeUUID&quot; : &quot;A1819DA4-A7E6-453F-AC28-5B0CD7C84E42&quot;,
    &quot;sip&quot; : &quot;enabled&quot;,
    &quot;vmRegionInfo&quot; : &quot;0x108364208 is not in any region.  Bytes after previous region: 521  Bytes before following region: 581549560\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      mapped file                 108330000-108364000    [  208K] r--\/r-- SM=COW  ...t_id=be3988bd\n---&gt;  GAP OF 0x22a9c000 BYTES\n      MALLOC_TINY                 12ae00000-12af00000    [ 1024K] rw-\/rwx SM=PRV  &quot;,
    &quot;isCorpse&quot; : 1,
    &quot;exception&quot; : {&quot;codes&quot;:&quot;0x0000000000000001, 0x0000000108364208&quot;,&quot;rawCodes&quot;:[1,4432740872],&quot;type&quot;:&quot;EXC_BAD_ACCESS&quot;,&quot;signal&quot;:&quot;SIGSEGV&quot;,&quot;subtype&quot;:&quot;KERN_INVALID_ADDRESS at 0x0000000108364208&quot;},
    &quot;vmregioninfo&quot; : &quot;0x108364208 is not in any region.  Bytes after previous region: 521  Bytes before following region: 581549560\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      mapped file                 108330000-108364000    [  208K] r--\/r-- SM=COW  ...t_id=be3988bd\n---&gt;  GAP OF 0x22a9c000 BYTES\n      MALLOC_TINY                 12ae00000-12af00000    [ 1024K] rw-\/rwx SM=PRV  &quot;,
    &quot;extMods&quot; : {&quot;caller&quot;:{&quot;thread_create&quot;:0,&quot;thread_set_state&quot;:0,&quot;task_for_pid&quot;:0},&quot;system&quot;:{&quot;thread_create&quot;:0,&quot;thread_set_state&quot;:2506,&quot;task_for_pid&quot;:40},&quot;targeted&quot;:{&quot;thread_create&quot;:0,&quot;thread_set_state&quot;:0,&quot;task_for_pid&quot;:0},&quot;warnings&quot;:0},
    &quot;faultingThread&quot; : 1,
    &quot;threads&quot; : [{&quot;id&quot;:2669441,&quot;queue&quot;:&quot;com.apple.main-thread&quot;,&quot;frames&quot;:[{&quot;imageOffset&quot;:19992,&quot;symbol&quot;:&quot;szone_free_definite_size&quot;,&quot;symbolLocation&quot;:240,&quot;imageIndex&quot;:0},{&quot;imageOffset&quot;:17863256,&quot;symbol&quot;:&quot;swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass()&quot;,&quot;symbolLocation&quot;:408,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:17863256,&quot;symbol&quot;:&quot;swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass()&quot;,&quot;symbolLocation&quot;:408,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:17717584,&quot;symbol&quot;:&quot;swift::GenericSignatureBuilder::Implementation::~Implementation()&quot;,&quot;symbolLocation&quot;:392,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:16048324,&quot;symbol&quot;:&quot;swift::ASTContext::Implementation::Arena::~Arena()&quot;,&quot;symbolLocation&quot;:716,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:15921076,&quot;symbol&quot;:&quot;swift::ASTContext::~ASTContext()&quot;,&quot;symbolLocation&quot;:288,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:2047324,&quot;symbol&quot;:&quot;swift::CompilerInstance::~CompilerInstance()&quot;,&quot;symbolLocation&quot;:316,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:771508,&quot;symbol&quot;:&quot;swift::performFrontend(llvm::ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*)&quot;,&quot;symbolLocation&quot;:2488,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:93688,&quot;symbol&quot;:&quot;main&quot;,&quot;symbolLocation&quot;:932,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:20724,&quot;symbol&quot;:&quot;start&quot;,&quot;symbolLocation&quot;:520,&quot;imageIndex&quot;:2}]},{&quot;triggered&quot;:true,&quot;id&quot;:2669443,&quot;threadState&quot;:{&quot;x&quot;:[{&quot;value&quot;:4432740872},{&quot;value&quot;:4414550528},{&quot;value&quot;:5283802768},{&quot;value&quot;:1},{&quot;value&quot;:14},{&quot;value&quot;:1},{&quot;value&quot;:0},{&quot;value&quot;:0},{&quot;value&quot;:5294210200},{&quot;value&quot;:10507},{&quot;value&quot;:982096},{&quot;value&quot;:1548097},{&quot;value&quot;:5283774464},{&quot;value&quot;:0},{&quot;value&quot;:1566685539},{&quot;value&quot;:47882},{&quot;value&quot;:27640526772},{&quot;value&quot;:4432740872},{&quot;value&quot;:0},{&quot;value&quot;:5294181264},{&quot;value&quot;:0},{&quot;value&quot;:5294211136},{&quot;value&quot;:5294210192},{&quot;value&quot;:6159184096},{&quot;value&quot;:5294181264},{&quot;value&quot;:0},{&quot;value&quot;:9440476728,&quot;symbolLocation&quot;:16,&quot;symbol&quot;:&quot;taskHeapMetadata&quot;},{&quot;value&quot;:0},{&quot;value&quot;:6159184096}],&quot;flavor&quot;:&quot;ARM_THREAD_STATE64&quot;,&quot;lr&quot;:{&quot;value&quot;:9219059052},&quot;cpsr&quot;:{&quot;value&quot;:1610616832},&quot;fp&quot;:{&quot;value&quot;:6159183504},&quot;sp&quot;:{&quot;value&quot;:6159183456},&quot;esr&quot;:{&quot;value&quot;:2181038087,&quot;description&quot;:&quot;(Instruction Abort) Translation fault&quot;},&quot;pc&quot;:{&quot;value&quot;:4432740872,&quot;matchesCrashFrame&quot;:1},&quot;far&quot;:{&quot;value&quot;:4432740872}},&quot;queue&quot;:&quot;com.apple.root.user-initiated-qos.cooperative&quot;,&quot;frames&quot;:[{&quot;imageOffset&quot;:4432740872,&quot;imageIndex&quot;:3},{&quot;imageOffset&quot;:255920,&quot;symbol&quot;:&quot;swift_job_runImpl(swift::Job*, swift::ExecutorRef)&quot;,&quot;symbolLocation&quot;:76,&quot;imageIndex&quot;:4},{&quot;imageOffset&quot;:86812,&quot;symbol&quot;:&quot;_dispatch_root_queue_drain&quot;,&quot;symbolLocation&quot;:396,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:88920,&quot;symbol&quot;:&quot;_dispatch_worker_thread2&quot;,&quot;symbolLocation&quot;:164,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:13000,&quot;symbol&quot;:&quot;_pthread_wqthread&quot;,&quot;symbolLocation&quot;:228,&quot;imageIndex&quot;:6},{&quot;imageOffset&quot;:8216,&quot;symbol&quot;:&quot;start_wqthread&quot;,&quot;symbolLocation&quot;:8,&quot;imageIndex&quot;:6}]},{&quot;id&quot;:2669444,&quot;queue&quot;:&quot;com.apple.root.user-initiated-qos.cooperative&quot;,&quot;frames&quot;:[{&quot;imageOffset&quot;:9128,&quot;symbol&quot;:&quot;access&quot;,&quot;symbolLocation&quot;:8,&quot;imageIndex&quot;:7},{&quot;imageOffset&quot;:70544812,&quot;symbol&quot;:&quot;llvm::sys::fs::access(llvm::Twine const&amp;, llvm::sys::fs::AccessMode)&quot;,&quot;symbolLocation&quot;:84,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:70557984,&quot;symbol&quot;:&quot;llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef&lt;llvm::StringRef&gt;)&quot;,&quot;symbolLocation&quot;:416,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:70561448,&quot;symbol&quot;:&quot;printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&amp;)&quot;,&quot;symbolLocation&quot;:588,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:70564336,&quot;symbol&quot;:&quot;llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int)&quot;,&quot;symbolLocation&quot;:100,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:70560460,&quot;symbol&quot;:&quot;llvm::sys::RunSignalHandlers()&quot;,&quot;symbolLocation&quot;:128,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:70565892,&quot;symbol&quot;:&quot;SignalHandler(int)&quot;,&quot;symbolLocation&quot;:292,&quot;imageIndex&quot;:1},{&quot;imageOffset&quot;:17636,&quot;symbol&quot;:&quot;_sigtramp&quot;,&quot;symbolLocation&quot;:56,&quot;imageIndex&quot;:8},{&quot;imageOffset&quot;:253292,&quot;symbol&quot;:&quot;swift::runJobInEstablishedExecutorContext(swift::Job*)&quot;,&quot;symbolLocation&quot;:280,&quot;imageIndex&quot;:4},{&quot;imageOffset&quot;:255920,&quot;symbol&quot;:&quot;swift_job_runImpl(swift::Job*, swift::ExecutorRef)&quot;,&quot;symbolLocation&quot;:76,&quot;imageIndex&quot;:4},{&quot;imageOffset&quot;:86812,&quot;symbol&quot;:&quot;_dispatch_root_queue_drain&quot;,&quot;symbolLocation&quot;:396,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:88920,&quot;symbol&quot;:&quot;_dispatch_worker_thread2&quot;,&quot;symbolLocation&quot;:164,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:13000,&quot;symbol&quot;:&quot;_pthread_wqthread&quot;,&quot;symbolLocation&quot;:228,&quot;imageIndex&quot;:6},{&quot;imageOffset&quot;:8216,&quot;symbol&quot;:&quot;start_wqthread&quot;,&quot;symbolLocation&quot;:8,&quot;imageIndex&quot;:6}]},{&quot;id&quot;:2669445,&quot;queue&quot;:&quot;com.apple.root.user-initiated-qos.cooperative&quot;,&quot;frames&quot;:[{&quot;imageOffset&quot;:4432740872,&quot;imageIndex&quot;:3},{&quot;imageOffset&quot;:255920,&quot;symbol&quot;:&quot;swift_job_runImpl(swift::Job*, swift::ExecutorRef)&quot;,&quot;symbolLocation&quot;:76,&quot;imageIndex&quot;:4},{&quot;imageOffset&quot;:86812,&quot;symbol&quot;:&quot;_dispatch_root_queue_drain&quot;,&quot;symbolLocation&quot;:396,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:88920,&quot;symbol&quot;:&quot;_dispatch_worker_thread2&quot;,&quot;symbolLocation&quot;:164,&quot;imageIndex&quot;:5},{&quot;imageOffset&quot;:13000,&quot;symbol&quot;:&quot;_pthread_wqthread&quot;,&quot;symbolLocation&quot;:228,&quot;imageIndex&quot;:6},{&quot;imageOffset&quot;:8216,&quot;symbol&quot;:&quot;start_wqthread&quot;,&quot;symbolLocation&quot;:8,&quot;imageIndex&quot;:6}]},{&quot;id&quot;:2669446,&quot;frames&quot;:[{&quot;imageOffset&quot;:8208,&quot;symbol&quot;:&quot;start_wqthread&quot;,&quot;symbolLocation&quot;:0,&quot;imageIndex&quot;:6}]}],
    &quot;usedImages&quot; : [
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 7103660032,
      &quot;size&quot; : 176128,
      &quot;uuid&quot; : &quot;961751ed-f18b-30d4-8025-aa12ca23197b&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/system\/libsystem_malloc.dylib&quot;,
      &quot;name&quot; : &quot;libsystem_malloc.dylib&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64&quot;,
      &quot;base&quot; : 4308254720,
      &quot;size&quot; : 85426176,
      &quot;uuid&quot; : &quot;a80c4d84-e9ff-3e38-8e35-666b1f91f585&quot;,
      &quot;path&quot; : &quot;\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift-frontend&quot;,
      &quot;name&quot; : &quot;swift-frontend&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 4415078400,
      &quot;size&quot; : 393216,
      &quot;uuid&quot; : &quot;d21a73ea-79cd-36eb-8ac9-2c5cf5181a27&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/dyld&quot;,
      &quot;name&quot; : &quot;dyld&quot;
    },
    {
      &quot;size&quot; : 0,
      &quot;source&quot; : &quot;A&quot;,
      &quot;base&quot; : 0,
      &quot;uuid&quot; : &quot;00000000-0000-0000-0000-000000000000&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 9218805760,
      &quot;size&quot; : 344064,
      &quot;uuid&quot; : &quot;50b9f80c-f39b-3792-b642-1ff1684a50b3&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/swift\/libswift_Concurrency.dylib&quot;,
      &quot;name&quot; : &quot;libswift_Concurrency.dylib&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 7103836160,
      &quot;size&quot; : 290816,
      &quot;uuid&quot; : &quot;93e1dcfc-ef56-3113-8e7c-1ba85266a93b&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/system\/libdispatch.dylib&quot;,
      &quot;name&quot; : &quot;libdispatch.dylib&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 7105650688,
      &quot;size&quot; : 53248,
      &quot;uuid&quot; : &quot;f7b2eccf-e6f1-3109-ae81-9028c0b8332a&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/system\/libsystem_pthread.dylib&quot;,
      &quot;name&quot; : &quot;libsystem_pthread.dylib&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 7105429504,
      &quot;size&quot; : 221184,
      &quot;uuid&quot; : &quot;384945e6-dd71-37e5-9a3d-84fff14a1e60&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/system\/libsystem_kernel.dylib&quot;,
      &quot;name&quot; : &quot;libsystem_kernel.dylib&quot;
    },
    {
      &quot;source&quot; : &quot;P&quot;,
      &quot;arch&quot; : &quot;arm64e&quot;,
      &quot;base&quot; : 7105757184,
      &quot;size&quot; : 32768,
      &quot;uuid&quot; : &quot;49cf1536-27e5-3a34-9724-d75552cbab56&quot;,
      &quot;path&quot; : &quot;\/usr\/lib\/system\/libsystem_platform.dylib&quot;,
      &quot;name&quot; : &quot;libsystem_platform.dylib&quot;
    }
  ],
    &quot;sharedCache&quot; : {
    &quot;base&quot; : 7102480384,
    &quot;size&quot; : 3091218432,
    &quot;uuid&quot; : &quot;296eb28e-6aeb-3129-8fa6-feb92261a4eb&quot;
  },
    &quot;vmSummary&quot; : &quot;ReadOnly portion of Libraries: Total=684.4M resident=0K(0%) swapped_out_or_unallocated=684.4M(100%)\nWritable regions: Total=813.9M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=813.9M(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           179.2M       18 \nMALLOC guard page                   96K        5 \nMALLOC_MEDIUM (reserved)         240.0M        2         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.1M        5 \nStack                             10.1M        5 \nVM_ALLOCATE                        1.0G        1 \nVM_ALLOCATE (reserved)             256K        1         reserved VM address space (unallocated)\n__AUTH                             112K       14 \n__AUTH_CONST                       219K       44 \n__DATA                             765K       43 \n__DATA_CONST                      4898K       46 \n__DATA_DIRTY                       164K       23 \n__LINKEDIT                       590.7M        3 \n__OBJC_CONST                        12K        6 \n__OBJC_RO                         82.1M        1 \n__OBJC_RW                         3104K        1 \n__TEXT                            93.6M       49 \ndyld private memory               1024K        1 \nmapped file                       14.9M        5 \nshared memory                       32K        2 \n===========                     =======  ======= \nTOTAL                              2.6G      278 \nTOTAL, minus reserved VM space     2.0G      278 \n&quot;,
    &quot;legacyInfo&quot; : {
    &quot;threadTriggered&quot; : {
      &quot;queue&quot; : &quot;com.apple.root.user-initiated-qos.cooperative&quot;
    }
  },
    &quot;trialInfo&quot; : {
    &quot;rollouts&quot; : [
      {
        &quot;rolloutId&quot; : &quot;60356660bbe37970735c5624&quot;,
        &quot;factorPackIds&quot; : {
  
        },
        &quot;deploymentId&quot; : 250000013
      },
      {
        &quot;rolloutId&quot; : &quot;60da5e84ab0ca017dace9abf&quot;,
        &quot;factorPackIds&quot; : {
  
        },
        &quot;deploymentId&quot; : 240000008
      },
      {
        &quot;rolloutId&quot; : &quot;607844aa04477260f58a8077&quot;,
        &quot;factorPackIds&quot; : {
          &quot;SIRI_MORPHUN_ASSETS&quot; : &quot;6103050cbfe6dc472e1c982a&quot;
        },
        &quot;deploymentId&quot; : 240000066
      },
      {
        &quot;rolloutId&quot; : &quot;602ad4dac86151000cf27e46&quot;,
        &quot;factorPackIds&quot; : {
          &quot;SIRI_DICTATION_ASSETS&quot; : &quot;61fb0e87c773c43cde3bb80e&quot;
        },
        &quot;deploymentId&quot; : 240000305
      },
      {
        &quot;rolloutId&quot; : &quot;5fc94383418129005b4e9ae0&quot;,
        &quot;factorPackIds&quot; : {
  
        },
        &quot;deploymentId&quot; : 240000231
      },
      {
        &quot;rolloutId&quot; : &quot;5ffde50ce2aacd000d47a95f&quot;,
        &quot;factorPackIds&quot; : {
  
        },
        &quot;deploymentId&quot; : 240000106
      },
      {
        &quot;rolloutId&quot; : &quot;601d9415f79519000ccd4b69&quot;,
        &quot;factorPackIds&quot; : {
          &quot;SIRI_TEXT_TO_SPEECH&quot; : &quot;620161cb295c182621eced20&quot;
        },
        &quot;deploymentId&quot; : 240000389
      }
    ],
    &quot;experiments&quot; : [
  
    ]
  }
  }
  </code></pre>
  <p>I think maybe I misunderstood the way to use Task.sleep. I'd appreciate it if someone could tell me why the segment fault occurs and how to fix it. Thanks!</p>