处理来自 Cloudant 的更改源时块长度无效

问题描述 投票:0回答:1

在处理 cloudant 更改源时,我遇到了一个奇怪的错误。我设置了这样的连续馈送:

feed = changes(feed='continuous', include_docs=True, since=db_seqno,filter="xyz/changesFilter")
for change in feed:

大多数情况下,提要运行得很好。几个小时后,它开始给出此错误“无效的块长度”。这是 urllib 库的问题吗?我应该升级它还是做其他事情。

("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 700, 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 "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 441, in _error_catcher
    yield
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 767, in read_chunked
    self._update_chunk_length()
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 704, in _update_chunk_length
    raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 760, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 575, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 796, in read_chunked
    self._original_response.close()
  File "/home/ubuntu/anaconda3/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 458, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/deploy/test.py", line 118, in startchangesfeed
    for change in feed:
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/feed.py", line 147, in __next__
    return self.next()  # pylint: disable=not-callable
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/feed.py", line 161, in next
    skip, data = self._process_data(next_(self._lines))
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/_2to3.py", line 87, in next_
    return next(itr)
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 804, in iter_lines
    for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 763, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
[2022-12-03 04:28:45] ERROR [test.py.startchangesfeed:150] ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 700, 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 "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 441, in _error_catcher
    yield
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 767, in read_chunked
    self._update_chunk_length()
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 704, in _update_chunk_length
    raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 760, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 575, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 796, in read_chunked
    self._original_response.close()
  File "/home/ubuntu/anaconda3/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/urllib3/response.py", line 458, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/deploy/test.py", line 118, in startchangesfeed
    for change in feed:
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/feed.py", line 147, in __next__
    return self.next()  # pylint: disable=not-callable
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/feed.py", line 161, in next
    skip, data = self._process_data(next_(self._lines))
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/cloudant/_2to3.py", line 87, in next_
    return next(itr)
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 804, in iter_lines
    for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode):
  File "/home/ubuntu/anaconda3/lib/python3.9/site-packages/requests/models.py", line 763, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
python couchdb cloudant
1个回答
0
投票

您的 CPU 可能会受到限制,因为某些更改可能会等待其他更改完成解析,从而超时,请尝试将 couchdb 配置文件中的 os_process_timeout 更改为更高的值。

© www.soinside.com 2019 - 2024. All rights reserved.