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

IncompleteRead while watching #972

Closed
max-rocket-internet opened this issue Sep 26, 2019 · 14 comments
Closed

IncompleteRead while watching #972

max-rocket-internet opened this issue Sep 26, 2019 · 14 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@max-rocket-internet
Copy link

max-rocket-internet commented Sep 26, 2019

What happened (please include outputs or screenshots):

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 603, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 362, in _error_catcher
    yield
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 668, in read_chunked
    self._update_chunk_length()
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 607, in _update_chunk_length
    raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "controller.py", line 21, in <module>
    for event in stream:
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 134, in stream
    for line in iter_resp_lines(resp):
  File "/usr/local/lib/python3.7/site-packages/kubernetes/watch/watch.py", line 47, in iter_resp_lines
    for seg in resp.read_chunked(decode_content=False):
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 696, in read_chunked
    self._original_response.close()
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 380, in _error_catcher
    raise ProtocolError('Connection broken: %r' % e, e)
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

What you expected to happen:

The watcher to always recover and continue watching for events.

How to reproduce it (as minimally and precisely as possible):

Tricky. I've only seen it once and it was random. My application just watches a CRD for changes.

Environment:

  • Kubernetes version (kubectl version): v1.12.10-eks
  • Python version (python --version) 3.7.0
  • Python client version (pip list | grep kubernetes) 9.0.0

Duplicate issues:

Identical issues that were close by the bot: #728 #540

@max-rocket-internet max-rocket-internet added the kind/bug Categorizes issue or PR as related to a bug. label Sep 26, 2019
@micw523
Copy link
Contributor

micw523 commented Oct 1, 2019

There should be a PR in progress: kubernetes-client/python-base#133

@jinchihe
Copy link

Hey @micw523 How to work around this? Seems the PR still be not merged. Thanks.

@micw523
Copy link
Contributor

micw523 commented Dec 19, 2019

Hi @jinchihe , @roycaihw might have a better idea about this.

@jinchihe
Copy link

@roycaihw is there way to work around the issue? except shorten waiting time. Thanks a lot!

@jinchihe
Copy link

I worked around this via @retrying.retry. :-) but still I think we need the enhancement, thanks.

@max-rocket-internet
Copy link
Author

I worked around this via @retrying.retry

How does that work?

@jinchihe
Copy link

jinchihe commented Jan 3, 2020

@max-rocket-internet I added the @retrying.retry(wait_fixed=1000, stop_max_attempt_number=20) for my watching function :-)

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 2, 2020
airshipbot pushed a commit to airshipit/armada that referenced this issue Apr 20, 2020
Armada uses a Kubernetes watch to implement its chart wait logic. This
can be a fairly long-lived connection to the Kubernetes API server, and
is vulnerable to disruption (if, for example, the kubernetes apiserver
chart is being upgraded).

This change allows Armada to retry the wait for some specific errors,
including the establishment of a new watch, until the overall chart
timeout is reached.

kubernetes-client/python#972
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

Change-Id: I3e68a54becadd5b2a2343960a120bdc3de8e8515
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 2, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@pitwegner
Copy link

/reopen
/remove-lifecycle rotten
This issue is still present

@k8s-ci-robot
Copy link
Contributor

@pitwegner: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen
/remove-lifecycle rotten
This issue is still present

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Mar 21, 2021
@Guanyan1996
Copy link

This issue is still present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

7 participants