[SERVER-27240] ConnectBG must not close() while the background thread is active Created: 30/Nov/16 Updated: 28/May/19 Resolved: 07/Dec/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Networking |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.15, 3.2.12, 3.4.1, 3.5.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Mira Carey | Assignee: | Mira Carey |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Backport Completed: | |||||||||||||||||||||||||
| Backport Requested: |
v3.4, v3.2, v3.0
|
||||||||||||||||||||||||
| Sprint: | Platforms 2017-01-23 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||
| Description |
|
ConnectBG handles asynchronous connects by spinning up a background thread to call ::connect(). We kick that thread out of connect, after a timeout, by calling close. This isn't safe because:
Which can lead us to connect a fd to the wrong endpoint. We can work around this by only calling shutdown from the parent thread, waiting for the child to join, then calling close. |
| Comments |
| Comment by Githook User [ 08/Dec/16 ] |
|
Author: {u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}Message: It's unsafe to close a socket from another thread. Also, after Because of that, let's just do the connect without the background thread (cherry picked from commit a1baabeee5694aa8c4ffa1827233684d6c7fcc49) |
| Comment by Githook User [ 08/Dec/16 ] |
|
Author: {u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}Message: It's unsafe to close a socket from another thread. Also, after Because of that, let's just do the connect without the background thread (cherry picked from commit a1baabeee5694aa8c4ffa1827233684d6c7fcc49) |
| Comment by Githook User [ 08/Dec/16 ] |
|
Author: {u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}Message: It's unsafe to close a socket from another thread. Also, after Because of that, let's just do the connect without the background thread (cherry picked from commit a1baabeee5694aa8c4ffa1827233684d6c7fcc49) |
| Comment by Githook User [ 07/Dec/16 ] |
|
Author: {u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}Message: It's unsafe to close a socket from another thread. Also, after Because of that, let's just do the connect without the background thread |