projectatomic / atomic

Atomic Run Tool for installing/running/managing container images.
Other
524 stars 139 forks source link

connects('docker.sock') when invoking `atomic host` #486

Closed cgwalters closed 7 years ago

cgwalters commented 7 years ago

In general as the atomic command starts to wrap more commands, we shouldn't talk to all of them on init, only dynamically when necessary. This way if docker.service is down for some reason I can still atomic host pkg-add gdb or whatever to debug.

# strace -econnect  atomic host status
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5228, si_status=0, si_utime=0, si_stime=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5230, si_status=0, si_utime=0, si_stime=0} ---
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(7, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5232, si_status=0, si_utime=0, si_stime=0} ---
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/docker.sock"}, 22) = 0
connect(9, {sa_family=AF_LOCAL, sun_path="/var/run/dbus/system_bus_socket"}, 110) = 0
State: idle
Deployments:
● centos-atomic-continuous:centos-atomic-host/7/x86_64/devel/continuous
       Version: 2016.0.177 (2016-07-15 22:02:49)
    BaseCommit: 4d38d1b750258227e531ed74158b8e2180ca69c7a49366400b51b2bc93b3ef92
        Commit: 632a57e39eeff798b28b3e3a0c23c15fb6e40173cf8bd69bf2e8ae814510691a
        OSName: centos-atomic-host
  GPGSignature: (unsigned)
      Packages: strace
rhatdan commented 7 years ago

That will be nasty. We need a mechanism to catch all self.d.* calls and check if self.d was initialized. Perhaps a class property for self.d?

http://stackoverflow.com/questions/15226721/python-class-member-lazy-initialization

rhatdan commented 7 years ago

@giuseppe With your code in AtomicClient could you change

    def __init__(self):
        self._dockerclient = get_docker_client()

To only allocate _dockerclient on first usenot when the AtomicDocker object is created?

giuseppe commented 7 years ago

@rhatdan I'll work on a fix for it

rhatdan commented 7 years ago

I have begun working on it, but it is not as easy as one would hope.

I have begun playing with it, and here is what I have so far:

https://github.com/projectatomic/atomic/compare/master...rhatdan:nodocker?expand=1

rhatdan commented 7 years ago

This is fixed in the master branch.