[SERVER-41826] avoid unlinking the unix domain socket if another process is listening Created: 19/Jun/19  Updated: 06/Dec/22

Status: Open
Project: Core Server
Component/s: Internal Code, Networking
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mira Carey Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-41029 mongocryptd should not delete existin... Closed
Assigned Teams:
Service Arch
Sprint: Service Arch 2019-07-15, Service Arch 2019-08-12, Service Arch 2019-08-26, Service Arch 2019-09-09, Service Arch 2019-09-23, Service Arch 2019-10-07, Service Arch 2019-10-21
Participants:
Linked BF Score: 21

 Description   

Currently whenever we bind a unix domain socket we first try to unlink it. This is to avoid a scenario where we crashed and left the old file around (because bind can't succeed if a file is already there).

Rather than performing that flow, if instead we:

if (bind()) {
    // we're bound, done!
    return;
}
 
if (non_blocking_connect_succeeds_or_fails_with_eagain()) {
    // someone else is listening, go away!
    fassert("address in use");
}
 
// there's a file there, but no one listening.  I.e. the old path
unlink();
bind();
return;

Then we can avoid trampling on a running mongod and instead fail the process that's starting up



 Comments   
Comment by Lauren Lewis (Inactive) [ 21/Dec/21 ]

We haven’t heard back from you in at least 1 year, so I'm going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Generated at Thu Feb 08 04:58:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.