Closed LiLiKazine closed 2 years ago
Maybe ? Any crash log related to this ?
Maybe ? Any crash log related to this ?
No, just come to my mind when reading the source code, but I found some issues closed earlier mentioned crashes on enqueue
method, could it be related to this?
And it's not likely to happen in my case, which all jobs are scheduled in a single queue.
This data racing problem should be easier to appear when multiple queues are created at same time(In Theory)
@LiLiKazine I see, that's interesting. If that's a case, I should be able to reproduce the crash in unit test if I spawn many thread and randomly schedule lot of jobs in parallel.
Let me try that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Indeed looks like scheduling task in multi thread env doesn't work very well
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber objectForKey:]: unrecognized selector sent to instance 0x8000000000000000'
*** First throw call stack:
(
0 CoreFoundation 0x000000018f6e6b08 __exceptionPreprocess + 240
1 libobjc.A.dylib 0x000000018f431e14 objc_exception_throw + 60
2 CoreFoundation 0x000000018f77aa68 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x000000018f645e14 ___forwarding___ + 1764
4 CoreFoundation 0x000000018f645670 _CF_forwarding_prep_0 + 96
5 libswiftCore.dylib 0x000000019c7b6884 $sSD8_VariantVyq_Sgxcig + 100
6 SwiftQueuePackageTests 0x000000010793d6cc $s10SwiftQueue0aB7ManagerC03getB09queueNameAA011SqOperationB0CSS_tF + 176
7 SwiftQueuePackageTests 0x000000010793d808 $s10SwiftQueue0aB7ManagerC7enqueue4infoyAA7JobInfoV_tF + 160
8 SwiftQueuePackageTests 0x000000010792c830 $s10SwiftQueue10JobBuilderC8schedule7manageryAA0aB7ManagerC_tF + 1480
9 SwiftQueuePackageTests 0x00000001079743fc $s15SwiftQueueTests0ab7ManagerC0C14testConcurrentyyFyycfU0_ + 380
10 SwiftQueuePackageTests 0x0000000107913008 $sIeg_IeyB_TR + 52
11 libdispatch.dylib 0x000000018f3d4604 _dispatch_call_block_and_release + 32
12 libdispatch.dylib 0x000000018f3d61c8 _dispatch_client_callout + 20
13 libdispatch.dylib 0x000000018f3d9670 _dispatch_continuation_pop + 500
14 libdispatch.dylib 0x000000018f3d8cdc _dispatch_async_redirect_invoke + 588
15 libdispatch.dylib 0x000000018f3e78e8 _dispatch_root_queue_drain + 396
16 libdispatch.dylib 0x000000018f3e8104 _dispatch_worker_thread2 + 164
17 libsystem_pthread.dylib 0x000000018f596324 _pthread_wqthread + 228
18 libsystem_pthread.dyliOperation
b 0x000000018f595080 start_wqthread + 8
Queues are managed by a dictionary in
SwiftQueueManager
, would there be data racing when multiple jobs scheduled from different threads at same time?