Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12492] Deadlock in swift_getTypeName TypeNameCacheLock #54934

Closed
erichoracek opened this issue Apr 2, 2020 · 1 comment
Closed

[SR-12492] Deadlock in swift_getTypeName TypeNameCacheLock #54934

erichoracek opened this issue Apr 2, 2020 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@erichoracek
Copy link

Previous ID SR-12492
Radar None
Original Reporter @erichoracek
Type Bug
Status Closed
Resolution Invalid

Attachment: Download

Environment

OS Version: iPhone OS 13.4 (17E255)

Xcode: 11.3.1

Swift: 5.1

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee None
Priority Medium

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.

@erichoracek
Copy link
Author

Turns out after much digging that this was due to an unrelated issue.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

1 participant