错误:PermissionError(13,'访问被拒绝',无,5,无)

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

我在使用芹菜时遇到此错误

[2024-10-06 14:38:15,464: ERROR/SpawnPoolWorker-3] Pool process <billiard.pool.Worker object at 0x0000016C0BBF5A00> error: PermissionError(13, 'Access is denied', None, 5, None)
Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 473, in receive
    ready, req = _receive(1.0)
                 ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 445, in _recv
    return True, loads(get_payload())
                       ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\queues.py", line 394, in get_payload    with self._rlock:
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\synchronize.py", line 115, in __enter__
    return self._semlock.__enter__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 351, in workloop
    req = wait_for_job()
          ^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 480, in receive
    raise SystemExit(EX_FAILURE)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 292, in __call__
    sys.exit(self.workloop(pid=pid))
             ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 396, in workloop
    self._ensure_messages_consumed(completed=completed)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 406, in _ensure_messages_consumed
    if self.on_ready_counter.value >= completed:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in getvalue
PermissionError: [WinError 5] Access is denied
[2024-10-06 14:38:15,464: ERROR/SpawnPoolWorker-3] Pool process <billiard.pool.Worker object at 0x0000016C0BBF5A00> error: PermissionError(13, 'Access is denied', None, 5, None)
Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 473, in receive
    ready, req = _receive(1.0)
                 ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 445, in _recv
    return True, loads(get_payload())
                       ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\queues.py", line 394, in get_payload    with self._rlock:
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\synchronize.py", line 115, in __enter__
    return self._semlock.__enter__()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 351, in workloop
    req = wait_for_job()
          ^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 480, in receive
    raise SystemExit(EX_FAILURE)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 292, in __call__
    sys.exit(self.workloop(pid=pid))
             ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 396, in workloop
    self._ensure_messages_consumed(completed=completed)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\billiard\pool.py", line 406, in _ensure_messages_consumed
    if self.on_ready_counter.value >= completed:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in getvalue
PermissionError: [WinError 5] Access is denied
[2024-10-06 14:38:15,642: ERROR/MainProcess] Process 'SpawnPoolWorker-3' pid:19032 exited with 'exitcode 1'
[2024-10-06 14:38:16,108: INFO/SpawnPoolWorker-9] child process 160 calling self.run()
[2024-10-06 14:38:23,846: INFO/MainProcess] Events of group {task} enabled by remote.
[2024-10-06 14:41:05,702: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py", line 340, in start
    blueprint.start(self)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\bootsteps.py", line 116, in start
    step.start(parent)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py", line 746, in start
    c.loop(*c.loop_args())
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\loops.py", line 130, in synloop    connection.drain_events(timeout=2.0)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\kombu\connection.py", line 341, in drain_events
    return self.transport.drain_events(self.connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\kombu\transport\pyamqp.py", line 171, in drain_events
    return connection.drain_events(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\connection.py", line 526, in drain_events
    while not self.blocking_read(timeout):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\connection.py", line 531, in blocking_read
    frame = self.transport.read_frame()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\transport.py", line 294, in read_frame
    frame_header = read(7, True)
                   ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\transport.py", line 637, in _read
    raise OSError('Server unexpectedly closed connection')
OSError: Server unexpectedly closed connection
[2024-10-06 14:41:05,780: WARNING/MainProcess] D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py:391: CPendingDeprecationWarning:
In Celery 5.1 we introduced an optional breaking change which
on connection loss cancels all currently executed tasks with late acknowledgement enabled.
These tasks cannot be acknowledged as the connection is gone, and the tasks are automatically redelivered
back to the queue. You can enable this behavior using the worker_cancel_long_running_tasks_on_connection_loss
setting. In Celery 5.1 it is set to False by default. The setting will be set to True by default in Celery 6.0.

  warnings.warn(CANCEL_TASKS_BY_DEFAULT, CPendingDeprecationWarning)

[2024-10-06 14:41:05,788: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2024-10-06 14:41:05,798: INFO/MainProcess] mingle: searching for neighbors
[2024-10-06 14:41:06,826: INFO/MainProcess] mingle: all alone
[2024-10-06 14:44:05,784: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py", line 340, in start
    blueprint.start(self)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\bootsteps.py", line 116, in start
    step.start(parent)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py", line 746, in start
    c.loop(*c.loop_args())
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\loops.py", line 130, in synloop    connection.drain_events(timeout=2.0)
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\kombu\connection.py", line 341, in drain_events
    return self.transport.drain_events(self.connection, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\kombu\transport\pyamqp.py", line 171, in drain_events
    return connection.drain_events(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\connection.py", line 526, in drain_events
    while not self.blocking_read(timeout):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\connection.py", line 531, in blocking_read
    frame = self.transport.read_frame()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\transport.py", line 294, in read_frame
    frame_header = read(7, True)
                   ^^^^^^^^^^^^^
  File "D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\amqp\transport.py", line 637, in _read
    raise OSError('Server unexpectedly closed connection')
OSError: Server unexpectedly closed connection
[2024-10-06 14:44:33,538: WARNING/MainProcess] D:\study\learning-python\back-end\ecommerce\venv\Lib\site-packages\celery\worker\consumer\consumer.py:391: CPendingDeprecationWarning:
In Celery 5.1 we introduced an optional breaking change which
on connection loss cancels all currently executed tasks with late acknowledgement enabled.
These tasks cannot be acknowledged as the connection is gone, and the tasks are automatically redelivered
back to the queue. You can enable this behavior using the worker_cancel_long_running_tasks_on_connection_loss
setting. In Celery 5.1 it is set to False by default. The setting will be set to True by default in Celery 6.0.

  warnings.warn(CANCEL_TASKS_BY_DEFAULT, CPendingDeprecationWarning)

这是完整的错误消息,我提供它是为了更好地理解问题 我正在使用具有管理权限的 cmd,但没有成功 我正在使用 Django 和 celery 以及 RabbitMQ 来构建异步任务以向客户端发送电子邮件。

我尝试让 cmd 成为管理,正如我所提到的,我只用 celery 执行两个任务,但它给了我这个错误。

django asynchronous rabbitmq celery
1个回答
0
投票

我遇到了同样的错误,但在安装 gevent 并在命令中添加 gevent 之后,它对我有用。

pip 安装 gevent

celery -A myproject 工作人员 --loglevel=info -P gevent

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