-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
podman network rm: blocks previously-used ports #10806
Comments
I cannot reproduce, does it happens always? Can you share more details about your environment. |
I was afraid of that. Can you try with # podman system service --timeout=0 &> /tmp/foo.log&
...
...and s/podman/podman-remote/ in all of the above I initially only saw it in podman-remote, but decided to test with plain podman, and saw it happening there too so I changed my report. But maybe the fact that I had used podman-remote got the system screwed up in such a way that even plain podman caused the error. |
Still no luck, can you check if you see errors in the journal. Also |
# journalctl -b 0
...
Jun 29 09:57:31 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com podman[4970]: 2021-06-29 09:57:31.19812397 -0400 EDT m=+35.823724698 container init 9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3 (image=quay.io/libpod/testimage:20210427, name=ccc, io.buildah.version=1.20.1, created_at=2021-04-27T20:53:39Z, created_by=test/system/build-testimage)
Jun 29 09:57:31 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com podman[4970]: 2021-06-29 09:57:31.2079887 -0400 EDT m=+35.833589437 container start 9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3 (image=quay.io/libpod/testimage:20210427, name=ccc, created_at=2021-04-27T20:53:39Z, created_by=test/system/build-testimage, io.buildah.version=1.20.1)
Jun 29 09:57:32 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975052.5748] policy: set-hostname: current hostname was changed outside NetworkManager: 'ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com'
Jun 29 09:57:37 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: libpod-9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3.scope: Deactivated successfully.
Jun 29 09:57:37 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com podman[5194]: 2021-06-29 09:57:37.827262403 -0400 EDT m=+0.061563494 container died 9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3 (image=quay.io/libpod/testimage:20210427, name=ccc)
Jun 29 09:57:38 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com podman[5194]: 2021-06-29 09:57:38.148993943 -0400 EDT m=+0.383295116 container cleanup 9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3 (image=quay.io/libpod/testimage:20210427, name=ccc, created_at=2021-04-27T20:53:39Z, created_by=test/system/build-testimage, io.buildah.version=1.20.1)
Jun 29 09:57:38 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: libpod-conmon-9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3.scope: Deactivated successfully.
Jun 29 09:57:40 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Jun 29 09:57:40 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 29 09:57:43 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com podman[5256]: 2021-06-29 09:57:43.921185028 -0400 EDT m=+0.082237566 container remove 9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3 (image=quay.io/libpod/testimage:20210427, name=ccc, io.buildah.version=1.20.1, created_at=2021-04-27T20:53:39Z, created_by=test/system/build-testimage)
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com kernel: device vethbdb11bfc left promiscuous mode
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com kernel: cni-podman1: port 1(vethbdb11bfc) entered disabled state
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com audit: ANOM_PROMISCUOUS dev=vethbdb11bfc prom=0 old_prom=256 auid=0 uid=0 gid=0 ses=3
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975084.9713] policy: set-hostname: current hostname was changed outside NetworkManager: 'ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com'
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975084.9723] policy: set-hostname: current hostname was changed outside NetworkManager: 'ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com'
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975084.9761] device (cni-podman1): state change: activated -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975084.9828] policy: set-hostname: current hostname was changed outside NetworkManager: 'ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com'
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: Starting Network Manager Script Dispatcher Service...
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com NetworkManager[476]: <info> [1624975084.9935] policy: set-hostname: current hostname was changed outside NetworkManager: 'ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com'
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: Started Network Manager Script Dispatcher Service.
Jun 29 09:58:04 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jun 29 09:58:14 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
Jun 29 09:58:14 ci-vm-10-0-138-127.hosted.upshift.rdu2.redhat.com audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
# iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 CNI-HOSTPORT-DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
6 360 CNI-HOSTPORT-DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
7 492 CNI-HOSTPORT-MASQ all -- * * 0.0.0.0/0 0.0.0.0/0 /* CNI portfwd requiring masquerade */
0 0 CNI-d24a60b7369e92d5454662cf all -- * * 192.168.240.2 0.0.0.0/0 /* name: "nnn" id: "9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3" */
Chain CNI-DN-d24a60b7369e92d545466 (1 references)
pkts bytes target prot opt in out source destination
0 0 CNI-HOSTPORT-SETMARK tcp -- * * 192.168.240.0/24 127.0.0.1 tcp dpt:55557
6 360 CNI-HOSTPORT-SETMARK tcp -- * * 127.0.0.1 127.0.0.1 tcp dpt:55557
6 360 DNAT tcp -- * * 0.0.0.0/0 127.0.0.1 tcp dpt:55557 to:192.168.240.2:55557
Chain CNI-HOSTPORT-DNAT (2 references)
pkts bytes target prot opt in out source destination
6 360 CNI-DN-d24a60b7369e92d545466 tcp -- * * 0.0.0.0/0 0.0.0.0/0 /* dnat name: "nnn" id: "9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3" */ multiport dports 55557
Chain CNI-HOSTPORT-MASQ (1 references)
pkts bytes target prot opt in out source destination
2 120 MASQUERADE all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x2000/0x2000
Chain CNI-HOSTPORT-SETMARK (2 references)
pkts bytes target prot opt in out source destination
6 360 MARK all -- * * 0.0.0.0/0 0.0.0.0/0 /* CNI portfwd masquerade mark */ MARK or 0x2000
Chain CNI-d24a60b7369e92d5454662cf (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 192.168.240.0/24 /* name: "nnn" id: "9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3" */
0 0 MASQUERADE all -- * * 0.0.0.0/0 !224.0.0.0/4 /* name: "nnn" id: "9005e6319a2c1213030063896666463267e8c8b7604a6f174c81582b25b3eaf3" */ |
VM available if you want it (for next few hours, say until 2000 CET). Ping me (esm) on Libera or internal IRC for access details. |
I don't have time today but I would like to take a look at it later this week. |
This looks like more of a |
This likely explains what I recently discovered was going on with my podman containers that intermittently caused some of their port mappings to fail with 'No route to host' when trying to I haven't been able to find a consistent repro yet, but seemed to happen pretty quickly when I was using docker-compose against |
Perhaps duplicate of #10745, affecting rootful containers and named networks? |
It could be related but I don't think so. I doubt that systemd is setting |
I am able to reproduce this on a freshly-booted 1minutetip VM. f34. podman-3.3.0-0.2.rc1.fc34.x86_64 5.12.10-300.fc34 # iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 CNI-HOSTPORT-DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
6 360 CNI-HOSTPORT-DNAT all -- * * 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
8 568 CNI-HOSTPORT-MASQ all -- * * 0.0.0.0/0 0.0.0.0/0 /* CNI portfwd requiring masquerade */
0 0 CNI-0acdcfaa03ae3de9fd1263d1 all -- * * 192.168.240.2 0.0.0.0/0 /* name: "nnn" id: "bf9dfd27d2965438a194df9093fbe98feae0ca45c58a3ac197c080fa155694c9" */
Chain CNI-0acdcfaa03ae3de9fd1263d1 (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 0.0.0.0/0 192.168.240.0/24 /* name: "nnn" id: "bf9dfd27d2965438a194df9093fbe98feae0ca45c58a3ac197c080fa155694c9" */
0 0 MASQUERADE all -- * * 0.0.0.0/0 !224.0.0.0/4 /* name: "nnn" id: "bf9dfd27d2965438a194df9093fbe98feae0ca45c58a3ac197c080fa155694c9" */
Chain CNI-DN-0acdcfaa03ae3de9fd126 (1 references)
pkts bytes target prot opt in out source destination
0 0 CNI-HOSTPORT-SETMARK tcp -- * * 192.168.240.0/24 127.0.0.1 tcp dpt:55557
6 360 CNI-HOSTPORT-SETMARK tcp -- * * 127.0.0.1 127.0.0.1 tcp dpt:55557
6 360 DNAT tcp -- * * 0.0.0.0/0 127.0.0.1 tcp dpt:55557 to:192.168.240.2:55557
Chain CNI-HOSTPORT-DNAT (2 references)
pkts bytes target prot opt in out source destination
6 360 CNI-DN-0acdcfaa03ae3de9fd126 tcp -- * * 0.0.0.0/0 0.0.0.0/0 /* dnat name: "nnn" id: "bf9dfd27d2965438a194df9093fbe98feae0ca45c58a3ac197c080fa155694c9" */ multiport dports 55557
Chain CNI-HOSTPORT-MASQ (1 references)
pkts bytes target prot opt in out source destination
2 120 MASQUERADE all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x2000/0x2000
Chain CNI-HOSTPORT-SETMARK (2 references)
pkts bytes target prot opt in out source destination
6 360 MARK all -- * * 0.0.0.0/0 0.0.0.0/0 /* CNI portfwd masquerade mark */ MARK or 0x2000 Run as root. No podman-remote has ever been run on this vm. |
And, FWIW, I see this on every system-test run I do, and I've been doing a lot of them lately for the spate of recent releases. |
Per #10886 whatever is adjusting the iptables rules should really adopt a naming scheme or use the comment module to label its commands, so podman can effectively cleanup or overwrite leftover rules as necessary, instead of leaving clutter in the iptables chains. |
@edsantiago So you just run |
I haven't run a before/after comparison of iptables rules. I'm just reporting that, after running the test, that port is forever gone. |
OK, I think I know the problem. Can you confim that |
Confirmed: by default, on login on a 1minutetip f34 VM:
If I |
According to the cni spec[1], a plugin should not return an error on del. If a plugin returns an error cni will not call the following plugins. Since the plugins are invoked in reverse order on del, the portmapping and bridge plugins won't get invoked and therefore leave iptables rules around. Fixes containers#67 Fixes containers/podman#10806 Fixes containers/podman#10745 [1] https://github.com/containernetworking/cni/blob/master/SPEC.md#del-remove-container-from-network-or-un-apply-modifications Signed-off-by: Paul Holzinger <[email protected]>
According to the cni spec[1], a plugin should not return an error on del. If a plugin returns an error cni will not call the following plugins. Since the plugins are invoked in reverse order on del, the portmapping and bridge plugins won't get invoked and therefore leave iptables rules around. Fixes containers#67 Fixes containers/podman#10806 Fixes containers/podman#10745 [1] https://github.com/containernetworking/cni/blob/master/SPEC.md#del-remove-container-from-network-or-un-apply-modifications Signed-off-by: Paul Holzinger <[email protected]>
Depending how the user logs in to the root account, XDG_RUNTIME_DIR is set to /run/user/0 or it is unset. For conmon we already set it always to an empty string. The inconsistency is causing issues for the dnsname plugin. To fix it unset XDG_RUNTIME_DIR for the podman process. [NO TESTS NEEDED] Fixes containers#10806 Fixes containers#10745 Signed-off-by: Paul Holzinger <[email protected]>
One test was using a hardcoded fixed port, with a comment referring to containers#10806. That issue seems fixed, so let's try switching to a pseudorandom open port. Does not actually fix containers#16289 but I'm going to close that anyway, will reopen if it recurs. Signed-off-by: Ed Santiago <[email protected]>
This one has plagued me for months but I knew it would be a pain to track down. Here it is (DO NOT TRY THIS ON YOUR LAPTOP UNLESS YOU WANT TO REBOOT):
That is: once the container stops, connecting to the port fails with ECONNREFUSED, which is the proper thing to do. But after running
podman network rm
, the previously-used port somehow becomes busy and completely unusable. It remains unusable forever or until the next reboot, whichever comes first.Root only, both local and remote. Everything works perfectly fine when rootless.
OBTW
netstat --inet -n | grep 555
does not show the port in use.The text was updated successfully, but these errors were encountered: