Skip to content

Conversation

@dcci
Copy link
Member

@dcci dcci commented Nov 19, 2019

rdar://problem/57123561

@dcci dcci requested a review from adrian-prantl November 19, 2019 23:55
@dcci
Copy link
Member Author

dcci commented Nov 19, 2019

Thanks to Adrian for helping me finding the root cause of this!

@dcci
Copy link
Member Author

dcci commented Nov 19, 2019

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

Thanks, there are a few obvious improvements that we can make while we're here.

Also: Can you = delete the copy constructor now?

m_swift_ast = target_swift_ast;
}
SwiftASTContext *swift_ast = m_swift_ast_sp.get();
SwiftASTContext *swift_ast = m_swift_ast;

Choose a reason for hiding this comment

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

I think we should get rid of m_swift_ast and only use the local copy, because it's not safe to hold on to the pointer without also holding on to the lock.

//----------------------------------------------------------------------
Status error;
if (!m_swift_ast_sp) {
if (!m_swift_ast) {

Choose a reason for hiding this comment

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

here we also need to acquire the scratch context lock. That's very easy if you just call target.GetSwiftScratchContext().

@dcci
Copy link
Member Author

dcci commented Nov 20, 2019

@swift-ci test

2 similar comments
@dcci
Copy link
Member Author

dcci commented Nov 20, 2019

@swift-ci test

@dcci
Copy link
Member Author

dcci commented Nov 20, 2019

@swift-ci test

@fredriss
Copy link

How do we make sure this keeps working? I know the crash didn't happen in our test environment, but is there a way to check that the setup is correct by looking at some side effect maybe?

@adrian-prantl
Copy link

Is there a separate pull request for acquiring the lock that I missed?

@dcci
Copy link
Member Author

dcci commented Nov 20, 2019

@fredriss We already have a test for this, but it only reproduces in a particular enviroment. If we end up testing that specific environment, we'll get coverage for free.

@adrian-prantl patch coming :)

@dcci dcci merged commit c3a1728 into swiftlang:swift/master Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants