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

connecache: fix multi-thread use of shared connection cache #4557

Closed
wants to merge 3 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Nov 3, 2019

It could accidentally let the connection get used by more than one
thread, leading to double-free and more.

Reported-by: Christopher Reid
Fixes #4544

@bagder
Copy link
Member Author

bagder commented Nov 4, 2019

nah, still not quite there, segfaults in test 1541

@bagder bagder force-pushed the bagder/shared-connection-race branch 3 times, most recently from 82e4147 to 94d3061 Compare November 6, 2019 10:39
@bagder
Copy link
Member Author

bagder commented Nov 8, 2019

I've now run test 1541 in this branch in a loop in my own FreeBSD 12 VM. 100 iterations and it didn't crash once. I've done the same on my Linux and it didn't crash once.

@bagder bagder force-pushed the bagder/shared-connection-race branch from 9e48b05 to e2b847a Compare November 8, 2019 13:46
@bagder bagder force-pushed the bagder/shared-connection-race branch 2 times, most recently from fb1db1a to 308d5d8 Compare December 3, 2019 22:07
@bagder
Copy link
Member Author

bagder commented Dec 8, 2019

I was able to reproduce this on mac and even though there's no valgrind on this platform, address sanitizer and more assert()s helped me this track down. Will polish and commit a fixup within shortly. Hopefully this was the same issue we saw on freebsd too.

It could accidentally let the connection get used by more than one
thread, leading to double-free and more.

Reported-by: Christopher Reid
Fixes #4544
@bagder bagder force-pushed the bagder/shared-connection-race branch from 307c058 to 0d150e0 Compare December 9, 2019 07:11
@bagder
Copy link
Member Author

bagder commented Dec 9, 2019

It seems to have fixed the race in 1541, but introduced a regression for 1700...

@bagder bagder closed this in ee263de Dec 9, 2019
@bagder bagder deleted the bagder/shared-connection-race branch December 9, 2019 14:31
@lock lock bot locked as resolved and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

CURL_LOCK_DATA_CONNECT can cause concurrent access to a connection on multiple threads
2 participants