Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

[swift-4.0-brach] TSan: Don't save stack in ThreadIgnoreBegin to avoid a deadlock when forking #10

Merged

Conversation

kubamracek
Copy link
Contributor

@kubamracek kubamracek commented Jul 7, 2017

This is a backport of a small part of r298809 which fixes a possible deadlock that happens on macOS when we fork to spawn the symbolizer. After fork(), we use login_tty, which in turn calls ioctl, which we have an interceptor for. Even when ignores are active, the interceptor will still access the stack depot and lock/unlock a spinlock via CurrentStackId(). We could have forked in a "bad state", when this spinlock was held by another thread. This fix just stops calling CurrentStackId from ScopedInterceptor's constructor, because it's not really necessary.

rdar://problem/31521889

@kubamracek kubamracek requested review from cheshire and vedantk July 7, 2017 04:55
@@ -277,7 +277,7 @@ ScopedInterceptor::~ScopedInterceptor() {

void ScopedInterceptor::EnableIgnores() {
if (ignoring_) {
ThreadIgnoreBegin(thr_, pc_);
ThreadIgnoreBegin(thr_, pc_, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we annotate the parameter?

/* save_stack= */ false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@cheshire cheshire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer parameter annotation, but that probably has to be done on master, not in this cherry-pick.

@kubamracek kubamracek merged commit 798fd20 into apple:swift-4.0-branch Jul 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants