remote: always send resize before the container starts

There is race condition in the remote client attach logic. Because the
resize api call was handled in an extra goroutine the container was
started before the resize call happend. To fix this we have to call
resize in the same goroutine as attach. When the first resize is done
start a goroutine to listen on SIGWINCH in the background and resize
again if the signal is received.

Fixes #9859

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2021-06-03 16:07:43 +02:00
parent 52dae693da
commit 1f73374acd
6 changed files with 40 additions and 40 deletions

View File

@ -49,7 +49,7 @@ class APITestCase(unittest.TestCase):
def setUp(self):
super().setUp()
APITestCase.podman.run("run", "alpine", "/bin/ls", check=True)
APITestCase.podman.run("run", "-d", "alpine", "top", check=True)
def tearDown(self) -> None:
APITestCase.podman.run("pod", "rm", "--all", "--force", check=True)

View File

@ -12,7 +12,7 @@ class ContainerTestCase(APITestCase):
r = requests.get(self.uri("/containers/json"), timeout=5)
self.assertEqual(r.status_code, 200, r.text)
obj = r.json()
self.assertEqual(len(obj), 0)
self.assertEqual(len(obj), 1)
def test_list_all(self):
r = requests.get(self.uri("/containers/json?all=true"))
@ -36,7 +36,7 @@ class ContainerTestCase(APITestCase):
self.assertId(r.content)
def test_delete(self):
r = requests.delete(self.uri(self.resolve_container("/containers/{}")))
r = requests.delete(self.uri(self.resolve_container("/containers/{}?force=true")))
self.assertEqual(r.status_code, 204, r.text)
def test_stop(self):