'Swift async functions with Task.sleep in it causes segmentation fault
I'm learning Swift concurrency now, and I've written some code to have a try on it. I've expected the "photo" with greater id to be "downloaded" earlier.
func downloadPhoto(id: Int) async -> String {
print("Download started")
let total = 3
try! await Task.sleep(nanoseconds: UInt64(total - id) * 1_000_000_000)
print("Download ended")
let str = "Photo \(id)"
print(str + " downloaded")
return str
}
Task{
print("Program started")
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)
}
However, when I saved the code to test.swift and run it with swift test.swift, I got the following output:
Program started
Download started
Download started
Download started
That is, none of the code after Task.sleep executed. To find out what's going wrong, I changed
try! await Task.sleep(nanoseconds: UInt64(total - id) * 1_000_000_000)
to
try! await Task.sleep(nanoseconds: 3)
and this time I got the expected output,
Program started
Download started
Download started
Download started
Download ended
Download ended
Photo 1 downloaded
Download ended
Photo 2 downloaded
Photo 0 downloaded
["Photo 0", "Photo 1", "Photo 2"]
Then, I changed the parameter 3 to 300000 and ran again. This time I got
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
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.
Here is the crash log:
-------------------------------------
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
---> 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<char const*>, 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&, llvm::sys::fs::AccessMode) + 84
2 swift-frontend 0x104ff6120 llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef<llvm::StringRef>) + 416
3 swift-frontend 0x104ff6ea8 printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&) + 588
4 swift-frontend 0x104ff79f0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, 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 (*) <961751ed-f18b-30d4-8025-aa12ca23197b> /usr/lib/system/libsystem_malloc.dylib
0x100cac000 - 0x105e23fff swift-frontend (*) <a80c4d84-e9ff-3e38-8e35-666b1f91f585> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend
0x10728c000 - 0x1072ebfff dyld (*) <d21a73ea-79cd-36eb-8ac9-2c5cf5181a27> /usr/lib/dyld
0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
0x2257bd000 - 0x225810fff libswift_Concurrency.dylib (*) <50b9f80c-f39b-3792-b642-1ff1684a50b3> /usr/lib/swift/libswift_Concurrency.dylib
0x1a76bf000 - 0x1a7705fff libdispatch.dylib (*) <93e1dcfc-ef56-3113-8e7c-1ba85266a93b> /usr/lib/system/libdispatch.dylib
0x1a787a000 - 0x1a7886fff libsystem_pthread.dylib (*) <f7b2eccf-e6f1-3109-ae81-9028c0b8332a> /usr/lib/system/libsystem_pthread.dylib
0x1a7844000 - 0x1a7879fff libsystem_kernel.dylib (*) <384945e6-dd71-37e5-9a3d-84fff14a1e60> /usr/lib/system/libsystem_kernel.dylib
0x1a7894000 - 0x1a789bfff libsystem_platform.dylib (*) <49cf1536-27e5-3a34-9724-d75552cbab56> /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
-----------
{"app_name":"swift-frontend","timestamp":"2022-02-17 00:08:58.00 +0800","app_version":"","slice_uuid":"a80c4d84-e9ff-3e38-8e35-666b1f91f585","build_version":"","platform":1,"share_with_app_devs":1,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.2.1 (21D62)","incident_id":"269117E0-1DFC-40A1-B7CF-5AEFE9FCF4D7","name":"swift-frontend"}
{
"uptime" : 330000,
"procLaunch" : "2022-02-17 00:08:58.0437 +0800",
"procRole" : "Unspecified",
"version" : 2,
"userID" : 501,
"deployVersion" : 210,
"modelCode" : "MacBookPro17,1",
"procStartAbsTime" : 7991622767392,
"coalitionID" : 14494,
"osVersion" : {
"train" : "macOS 12.2.1",
"build" : "21D62",
"releaseType" : "User"
},
"captureTime" : "2022-02-17 00:08:58.2001 +0800",
"incident" : "269117E0-1DFC-40A1-B7CF-5AEFE9FCF4D7",
"bug_type" : "309",
"pid" : 72033,
"procExitAbsTime" : 7991626514464,
"translated" : false,
"cpuType" : "ARM-64",
"procName" : "swift-frontend",
"procPath" : "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift-frontend",
"parentProc" : "zsh",
"parentPid" : 70066,
"coalitionName" : "com.apple.Terminal",
"crashReporterKey" : "7B963A0A-2299-D9C6-8085-A5F2F172ABC9",
"responsiblePid" : 70064,
"responsibleProc" : "Terminal",
"wakeTime" : 2804,
"sleepWakeUUID" : "A1819DA4-A7E6-453F-AC28-5B0CD7C84E42",
"sip" : "enabled",
"vmRegionInfo" : "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---> GAP OF 0x22a9c000 BYTES\n MALLOC_TINY 12ae00000-12af00000 [ 1024K] rw-\/rwx SM=PRV ",
"isCorpse" : 1,
"exception" : {"codes":"0x0000000000000001, 0x0000000108364208","rawCodes":[1,4432740872],"type":"EXC_BAD_ACCESS","signal":"SIGSEGV","subtype":"KERN_INVALID_ADDRESS at 0x0000000108364208"},
"vmregioninfo" : "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---> GAP OF 0x22a9c000 BYTES\n MALLOC_TINY 12ae00000-12af00000 [ 1024K] rw-\/rwx SM=PRV ",
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":2506,"task_for_pid":40},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"faultingThread" : 1,
"threads" : [{"id":2669441,"queue":"com.apple.main-thread","frames":[{"imageOffset":19992,"symbol":"szone_free_definite_size","symbolLocation":240,"imageIndex":0},{"imageOffset":17863256,"symbol":"swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass()","symbolLocation":408,"imageIndex":1},{"imageOffset":17863256,"symbol":"swift::GenericSignatureBuilder::EquivalenceClass::~EquivalenceClass()","symbolLocation":408,"imageIndex":1},{"imageOffset":17717584,"symbol":"swift::GenericSignatureBuilder::Implementation::~Implementation()","symbolLocation":392,"imageIndex":1},{"imageOffset":16048324,"symbol":"swift::ASTContext::Implementation::Arena::~Arena()","symbolLocation":716,"imageIndex":1},{"imageOffset":15921076,"symbol":"swift::ASTContext::~ASTContext()","symbolLocation":288,"imageIndex":1},{"imageOffset":2047324,"symbol":"swift::CompilerInstance::~CompilerInstance()","symbolLocation":316,"imageIndex":1},{"imageOffset":771508,"symbol":"swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)","symbolLocation":2488,"imageIndex":1},{"imageOffset":93688,"symbol":"main","symbolLocation":932,"imageIndex":1},{"imageOffset":20724,"symbol":"start","symbolLocation":520,"imageIndex":2}]},{"triggered":true,"id":2669443,"threadState":{"x":[{"value":4432740872},{"value":4414550528},{"value":5283802768},{"value":1},{"value":14},{"value":1},{"value":0},{"value":0},{"value":5294210200},{"value":10507},{"value":982096},{"value":1548097},{"value":5283774464},{"value":0},{"value":1566685539},{"value":47882},{"value":27640526772},{"value":4432740872},{"value":0},{"value":5294181264},{"value":0},{"value":5294211136},{"value":5294210192},{"value":6159184096},{"value":5294181264},{"value":0},{"value":9440476728,"symbolLocation":16,"symbol":"taskHeapMetadata"},{"value":0},{"value":6159184096}],"flavor":"ARM_THREAD_STATE64","lr":{"value":9219059052},"cpsr":{"value":1610616832},"fp":{"value":6159183504},"sp":{"value":6159183456},"esr":{"value":2181038087,"description":"(Instruction Abort) Translation fault"},"pc":{"value":4432740872,"matchesCrashFrame":1},"far":{"value":4432740872}},"queue":"com.apple.root.user-initiated-qos.cooperative","frames":[{"imageOffset":4432740872,"imageIndex":3},{"imageOffset":255920,"symbol":"swift_job_runImpl(swift::Job*, swift::ExecutorRef)","symbolLocation":76,"imageIndex":4},{"imageOffset":86812,"symbol":"_dispatch_root_queue_drain","symbolLocation":396,"imageIndex":5},{"imageOffset":88920,"symbol":"_dispatch_worker_thread2","symbolLocation":164,"imageIndex":5},{"imageOffset":13000,"symbol":"_pthread_wqthread","symbolLocation":228,"imageIndex":6},{"imageOffset":8216,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":6}]},{"id":2669444,"queue":"com.apple.root.user-initiated-qos.cooperative","frames":[{"imageOffset":9128,"symbol":"access","symbolLocation":8,"imageIndex":7},{"imageOffset":70544812,"symbol":"llvm::sys::fs::access(llvm::Twine const&, llvm::sys::fs::AccessMode)","symbolLocation":84,"imageIndex":1},{"imageOffset":70557984,"symbol":"llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef<llvm::StringRef>)","symbolLocation":416,"imageIndex":1},{"imageOffset":70561448,"symbol":"printSymbolizedStackTrace(llvm::StringRef, void**, int, llvm::raw_ostream&)","symbolLocation":588,"imageIndex":1},{"imageOffset":70564336,"symbol":"llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)","symbolLocation":100,"imageIndex":1},{"imageOffset":70560460,"symbol":"llvm::sys::RunSignalHandlers()","symbolLocation":128,"imageIndex":1},{"imageOffset":70565892,"symbol":"SignalHandler(int)","symbolLocation":292,"imageIndex":1},{"imageOffset":17636,"symbol":"_sigtramp","symbolLocation":56,"imageIndex":8},{"imageOffset":253292,"symbol":"swift::runJobInEstablishedExecutorContext(swift::Job*)","symbolLocation":280,"imageIndex":4},{"imageOffset":255920,"symbol":"swift_job_runImpl(swift::Job*, swift::ExecutorRef)","symbolLocation":76,"imageIndex":4},{"imageOffset":86812,"symbol":"_dispatch_root_queue_drain","symbolLocation":396,"imageIndex":5},{"imageOffset":88920,"symbol":"_dispatch_worker_thread2","symbolLocation":164,"imageIndex":5},{"imageOffset":13000,"symbol":"_pthread_wqthread","symbolLocation":228,"imageIndex":6},{"imageOffset":8216,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":6}]},{"id":2669445,"queue":"com.apple.root.user-initiated-qos.cooperative","frames":[{"imageOffset":4432740872,"imageIndex":3},{"imageOffset":255920,"symbol":"swift_job_runImpl(swift::Job*, swift::ExecutorRef)","symbolLocation":76,"imageIndex":4},{"imageOffset":86812,"symbol":"_dispatch_root_queue_drain","symbolLocation":396,"imageIndex":5},{"imageOffset":88920,"symbol":"_dispatch_worker_thread2","symbolLocation":164,"imageIndex":5},{"imageOffset":13000,"symbol":"_pthread_wqthread","symbolLocation":228,"imageIndex":6},{"imageOffset":8216,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":6}]},{"id":2669446,"frames":[{"imageOffset":8208,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":6}]}],
"usedImages" : [
{
"source" : "P",
"arch" : "arm64e",
"base" : 7103660032,
"size" : 176128,
"uuid" : "961751ed-f18b-30d4-8025-aa12ca23197b",
"path" : "\/usr\/lib\/system\/libsystem_malloc.dylib",
"name" : "libsystem_malloc.dylib"
},
{
"source" : "P",
"arch" : "arm64",
"base" : 4308254720,
"size" : 85426176,
"uuid" : "a80c4d84-e9ff-3e38-8e35-666b1f91f585",
"path" : "\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift-frontend",
"name" : "swift-frontend"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 4415078400,
"size" : 393216,
"uuid" : "d21a73ea-79cd-36eb-8ac9-2c5cf5181a27",
"path" : "\/usr\/lib\/dyld",
"name" : "dyld"
},
{
"size" : 0,
"source" : "A",
"base" : 0,
"uuid" : "00000000-0000-0000-0000-000000000000"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 9218805760,
"size" : 344064,
"uuid" : "50b9f80c-f39b-3792-b642-1ff1684a50b3",
"path" : "\/usr\/lib\/swift\/libswift_Concurrency.dylib",
"name" : "libswift_Concurrency.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7103836160,
"size" : 290816,
"uuid" : "93e1dcfc-ef56-3113-8e7c-1ba85266a93b",
"path" : "\/usr\/lib\/system\/libdispatch.dylib",
"name" : "libdispatch.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7105650688,
"size" : 53248,
"uuid" : "f7b2eccf-e6f1-3109-ae81-9028c0b8332a",
"path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
"name" : "libsystem_pthread.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7105429504,
"size" : 221184,
"uuid" : "384945e6-dd71-37e5-9a3d-84fff14a1e60",
"path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
"name" : "libsystem_kernel.dylib"
},
{
"source" : "P",
"arch" : "arm64e",
"base" : 7105757184,
"size" : 32768,
"uuid" : "49cf1536-27e5-3a34-9724-d75552cbab56",
"path" : "\/usr\/lib\/system\/libsystem_platform.dylib",
"name" : "libsystem_platform.dylib"
}
],
"sharedCache" : {
"base" : 7102480384,
"size" : 3091218432,
"uuid" : "296eb28e-6aeb-3129-8fa6-feb92261a4eb"
},
"vmSummary" : "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",
"legacyInfo" : {
"threadTriggered" : {
"queue" : "com.apple.root.user-initiated-qos.cooperative"
}
},
"trialInfo" : {
"rollouts" : [
{
"rolloutId" : "60356660bbe37970735c5624",
"factorPackIds" : {
},
"deploymentId" : 250000013
},
{
"rolloutId" : "60da5e84ab0ca017dace9abf",
"factorPackIds" : {
},
"deploymentId" : 240000008
},
{
"rolloutId" : "607844aa04477260f58a8077",
"factorPackIds" : {
"SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
},
"deploymentId" : 240000066
},
{
"rolloutId" : "602ad4dac86151000cf27e46",
"factorPackIds" : {
"SIRI_DICTATION_ASSETS" : "61fb0e87c773c43cde3bb80e"
},
"deploymentId" : 240000305
},
{
"rolloutId" : "5fc94383418129005b4e9ae0",
"factorPackIds" : {
},
"deploymentId" : 240000231
},
{
"rolloutId" : "5ffde50ce2aacd000d47a95f",
"factorPackIds" : {
},
"deploymentId" : 240000106
},
{
"rolloutId" : "601d9415f79519000ccd4b69",
"factorPackIds" : {
"SIRI_TEXT_TO_SPEECH" : "620161cb295c182621eced20"
},
"deploymentId" : 240000389
}
],
"experiments" : [
]
}
}
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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
