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

Race in container.ready #42

Open
Jc2k opened this issue Feb 21, 2022 · 1 comment
Open

Race in container.ready #42

Jc2k opened this issue Feb 21, 2022 · 1 comment

Comments

@Jc2k
Copy link
Owner

Jc2k commented Feb 21, 2022

PDB session

(Pdb) p self.ports.values()
[[]]
(Pdb) self.reload()
(Pdb) p self.ports.values()
[[51350]]

Maybe something like this?

        # If a user has exposed a port then wait for LISTEN socket to show up in netstat
        ports = self._container.attrs["NetworkSettings"]["Ports"]
        for port, listeners in ports.items():
            if not listeners:
                continue

 ++           if port not in self.ports:
 ++               return False

            port, proto = port.split("/")

            assert proto in ("tcp", "udp")

            if proto == "tcp" and port not in self.get_open_tcp_ports():
                return False

            if proto == "udp" and port not in self.get_open_udp_ports():
                return False
@Jc2k
Copy link
Owner Author

Jc2k commented Feb 21, 2022

First time seen it in 1000's of tests, so unlikely to repro outside of a unittest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant