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

Support for TCP upgrade #1130

Merged
merged 14 commits into from
Jul 18, 2016
Merged

Support for TCP upgrade #1130

merged 14 commits into from
Jul 18, 2016

Conversation

aanand
Copy link
Contributor

@aanand aanand commented Jul 13, 2016

Fixes #1123

ping @dnephin

dgageot and others added 12 commits July 13, 2016 17:08
- `read_data()` raises an exception instead of asserting `False`
- `next_packet_size()` uses `read_data()`
- Renamed `packet_size` arg to `n` for consistency

Signed-off-by: Aanand Prasad <[email protected]>
Signed-off-by: Aanand Prasad <[email protected]>
Signed-off-by: Aanand Prasad <[email protected]>
aanand added 2 commits July 13, 2016 17:41
This makes it more clearly high-level and distinct from the raw
data-reading functions

Signed-off-by: Aanand Prasad <[email protected]>
read_socket() is now just read(), because its behaviour is consistent
with `os.read` et al.

Signed-off-by: Aanand Prasad <[email protected]>
self._url('/exec/{0}/start', exec_id),
headers=headers,
data=data,
stream=True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stream changed here to always True. Is that correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Late answer, but yes, that's intentional. Without it, _read_from_socket cannot work properly. As far as the user is concerned, the output will still be presented according to their choice.

@dnephin
Copy link
Contributor

dnephin commented Jul 14, 2016

code LGTM, waiting on janky

@aanand aanand merged commit e15ba74 into docker:master Jul 18, 2016
@aanand aanand deleted the support-tcp-upgrade branch July 18, 2016 16:03
@shin- shin- added this to the 1.10.0 milestone Jul 26, 2016
Lekensteyn added a commit to Lekensteyn/docker-py that referenced this pull request Apr 26, 2019
Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes docker#1293
(Regression from docker#1130)

Signed-off-by: Peter Wu <[email protected]>
Lekensteyn added a commit to Lekensteyn/docker-py that referenced this pull request Apr 26, 2019
Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes docker#1293
(Regression from docker#1130)

Signed-off-by: Peter Wu <[email protected]>
riyad pushed a commit to riyad/docker-py that referenced this pull request Jan 7, 2022
Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes docker#1293
(Regression from docker#1130)

Signed-off-by: Peter Wu <[email protected]>
milas added a commit that referenced this pull request Jan 13, 2023
Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes #1293
(Regression from #1130)

Signed-off-by: Peter Wu <[email protected]>
Co-authored-by: Milas Bowman <[email protected]>
felixfontein added a commit to felixfontein/community.docker that referenced this pull request Feb 11, 2023
…py#2320)

Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes docker/docker-py#1293
(Regression from docker/docker-py#1130)

Cherry-picked from docker/docker-py@34e6829

Co-authored-by: Peter Wu <[email protected]>
Co-authored-by: Milas Bowman <[email protected]>
felixfontein added a commit to ansible-collections/community.docker that referenced this pull request Feb 12, 2023
…py#2320) (#582)

Requests with stream=True MUST be closed or else the connection will
never be returned to the connection pool. Both ContainerApiMixin.attach
and ExecApiMixin.exec_start were leaking in the stream=False case.
exec_start was modified to follow attach for the stream=True case as
that allows the caller to close the stream when done (untested).

Tested with:

    # Test exec_run (stream=False) - observe one less leak
    make integration-test-py3 file=models_containers_test.py' -k test_exec_run_success -vs -W error::ResourceWarning'
    # Test exec_start (stream=True, fully reads from CancellableStream)
    make integration-test-py3 file=api_exec_test.py' -k test_execute_command -vs -W error::ResourceWarning'

After this change, one resource leak is removed, the remaining resource
leaks occur because none of the tests call client.close().

Fixes docker/docker-py#1293
(Regression from docker/docker-py#1130)

Cherry-picked from docker/docker-py@34e6829

Co-authored-by: Peter Wu <[email protected]>
Co-authored-by: Milas Bowman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants