[SERVER-35385] _isSelf invoked unnecesarily on Debian-based distros Created: 04/Jun/18  Updated: 15/Apr/20  Resolved: 11/Jun/18

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Billy Donahue Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-47545 isSelf should consider any host addre... Closed
Operating System: ALL
Steps To Reproduce:

inject failure in _isSelf handler.

python buildscripts/resmoke.py \
   --suite no_passthrough \
   --mongodSetparameters='{logLevel : 2}' \
   jstests/noPassthrough/change_streams_required_privileges.js

Participants:
Linked BF Score: 0

 Description   

repl::isSelf has a fast path, and falls back to issuing _isSelf as a slow path.
For some reason the fast path doesn't kick in there, perhaps having to do with /proc file formats or ordering or the specifics of the Debian builder's network config.

Ubuntu 18.04 workstation shows the same symptom.



 Comments   
Comment by Billy Donahue [ 05/Jun/18 ]

I think Atlas nodes would take the fast path.

They're going to be using automated rsconfigs that mention each host by a network-accessible IP address (or DNS name) that resolves to an exact number they'd recognize as one of their  network interface addresses.

The slow path is taken when we're dealing with the ambiguities of nslookup of Unix hostname, the 127/8 subnet, and bind_ip=0.0.0.0. It would just be unit tests, really.

Comment by Andy Schwerin [ 05/Jun/18 ]

I think the isself shortcut behavior is a lot of code that delivers not much value. I'm curious if Atlas nodes meet the criteria for bypassing the check. If not, we should consider deleting the bypass code and always using the rpc to test for selfness.

Comment by Billy Donahue [ 04/Jun/18 ]

This happens because the Unix hostname appears in the replset config of this 1-node repl unit test.

getAddrsForHost("myhostname:20020") yields 127.0.1.1 on Debian systems,

In the test, we're using --bindIp 0.0.0.0.

When isSelf walks all the ifaces, it makes a list of local ip addresses to match against the addresses associated with the rsconfig-specified host.
This yields lo at 127.0.0.1 and some other LAN IP associated with the ethernet iface.
It does not come up with the 127.0.1.1 associated with the Unix hostname that getAddrsForHost returned.

So even though we are listening on 127.0.1.1:20020, and our hostname locally resolves to it, we don't consider 127.0.1.1 to be our "self".

 

{
    "replSetInitiate" : {
      "_id" : "change_streams_required_privileges",
      "protocolVersion" : 1,
      "members" : [
       

{           "_id" : 0,           "host" : "billydev:20020"         }

      ]
    }
}

 

 

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