关于PaddleHub Serving的服务部署后开启并发就出现requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))的问题

3gtaxfhh  于 5个月前  发布在  其他
关注(0)|答案(7)|浏览(88)

机器:4个单核CPU
部署环境:使用的是CPU的环境
没有任何问题
使用并发的方式启动服务器
hub serving start --modules ocr_system==1.0.0 --port 8866 --workers 4 --use_multiprocess
如果图片较大,就会出现:

Traceback (most recent call last):
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "D:\anaconda\lib\http\client.py", line 1347, in getresponse
    response.begin()
  File "D:\anaconda\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "D:\anaconda\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\anaconda\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "D:\anaconda\lib\site-packages\urllib3\util\retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "D:\anaconda\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "D:\anaconda\lib\http\client.py", line 1347, in getresponse
    response.begin()
  File "D:\anaconda\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "D:\anaconda\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/test_hubserving.py", line 158, in <module>
    main(args)
  File "tools/test_hubserving.py", line 115, in main
    r = requests.post(
  File "D:\anaconda\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\anaconda\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
PS E:\PaddleOCR-release-2.6> python tools/test_hubserving.py --server_url=http://192.168.10.6:8866/predict/ocr_system --image_dir=./doc/imgs/tests/test1.png
D:\anaconda\lib\site-packages\win32\lib\pywintypes.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp, sys, os
D:\anaconda\lib\site-packages\paddle\fluid\framework.py:634: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
  warnings.warn(
Traceback (most recent call last):
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "D:\anaconda\lib\http\client.py", line 1347, in getresponse
    response.begin()
  File "D:\anaconda\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "D:\anaconda\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\anaconda\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "D:\anaconda\lib\site-packages\urllib3\util\retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "D:\anaconda\lib\site-packages\urllib3\packages\six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "D:\anaconda\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "D:\anaconda\lib\http\client.py", line 1347, in getresponse
    response.begin()
  File "D:\anaconda\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "D:\anaconda\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/test_hubserving.py", line 158, in <module>
    main(args)
  File "tools/test_hubserving.py", line 115, in main
    r = requests.post(
  File "D:\anaconda\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\anaconda\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "D:\anaconda\lib\site-packages\requests\adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

如果使用:
hub serving start --modules ocr_system==1.0.0 --port 8866
进行启动服务就无法并发,但是对于出现以上情况的图片有响应结果

n1bvdmb6

n1bvdmb61#

你好,使用并发启动服务会报错,但是有响应结果吗?

llycmphe

llycmphe2#

你好,使用并发启动服务时会报错,但是有响应结果吗?
没有响应结果,报错后程序直接退出。

kzmpq1sx

kzmpq1sx3#

你好,hub的预训练模型库里好像没有ocr_system这个模块诶,这个是你自己实现的么?

92dk7w1h

92dk7w1h4#

你好,hub的预训练模型库里好像没有ocr_system这个模块诶,这个是你自己实现的么?
https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/deploy/hubserving/readme.md 我是使用这个文档进行部署的,ocr_system在这里面有。

9jyewag0

9jyewag05#

好的,我这边跟着复现一下试试。同时,你也可以在PaddleOCR提个issue,这个模块他们开发的可能能比我更快地给你提供帮助。

m4pnthwp

m4pnthwp6#

好的,我这边跟着复现一下试试,同时你也可以在PaddleOCR提个issue,这个模块他们开发的可能能比我更快的给你提供帮助。

好的,谢谢。

omtl5h9j

omtl5h9j7#

PaddleHub无法通过多线程来加速模型预测,因为PaddlePaddle自身的限制。如果您需要更多关于PaddleHub的信息,可以访问PaddleHub的官方网站。

相关问题