nacos-group / nacos-group/nacos-sdk-python

使用ctrl+c强制退出时,_process_polling_result无法处理异常

Open
#195 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
471
Forks
155
PR merge metrics
No merged PRs in 30d

Description

`Traceback (most recent call last):
File "d:\project\tailin\dev\crawler.conda\Lib\multiprocessing\connection.py", line 328, in _recv_bytes
nread, err = ov.GetOverlappedResult(True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [WinError 109] 管道已结束。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "d:\project\tailin\dev\crawler.conda\Lib\site-packages\nacos\client.py", line 818, in _process_polling_result
cache_key, content, md5 = self.notify_queue.get()
^^^^^^^^^^^^^^^^^^^^^^^
File "d:\project\tailin\dev\crawler.conda\Lib\multiprocessing\queues.py", line 103, in get
res = self._recv_bytes()
^^^^^^^^^^^^^^^^^^
File "d:\project\tailin\dev\crawler.conda\Lib\multiprocessing\connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\project\tailin\dev\crawler.conda\Lib\multiprocessing\connection.py", line 337, in _recv_bytes
raise EOFError
EOFError`

主动关闭主进程后, self.notify_queue,无法与主进程通信抛出异常。但是未做处理
怎么自己的代码中在生成对象后,遇到ctrl+c时处理这个错误呢

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nacos/client.py at _process_polling_result and reproduce the Ctrl+C shutdown described in the traceback on Windows. Trace how notify_queue is closed when the main process exits, then determine the expected behavior for the resulting EOFError; done means the shutdown path no longer produces an unhandled exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.