[SR-12492] Deadlock in swift_getTypeName TypeNameCacheLock #54934
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Attachment: Download
Environment
OS Version: iPhone OS 13.4 (17E255)
Xcode: 11.3.1
Swift: 5.1
Additional Detail from JIRA
md5: a43a149b0c1c318249f717b017373141
Issue Description:
We're seeing the iOS watchdog killing our app due to the main thread being blocked by the TypeNameCacheLock readwrite lock in swift_getTypeName. Many background threads are blocked as well.
In the attached stacktrace, we have many threads in something like the following state:
0 libsystem_kernel.dylib 0x0000000185f7ec88 __psynch_rw_rdlock + 8
1 libsystem_pthread.dylib 0x0000000185ea4490 _pthread_rwlock_lock_wait + 72
2 libsystem_pthread.dylib 0x0000000185ea4424 _pthread_rwlock_lock_slow + 680
3 libswiftCore.dylib 0x0000000193ccfcf8 swift::ReadWriteLockPlatformHelper::readLock+ 3374328 (_opaque_pthread_rwlock_t&) + 24
4 libswiftCore.dylib 0x0000000193ca2cec swift_getTypeName + 88
5 libswiftCore.dylib 0x0000000193aa86fc typeName+ 1115900 (:qualified) + 28
We're working on mitigating this crash on our end by calling type(of) less frequently.
The text was updated successfully, but these errors were encountered: