Gsutil: 'ForkAwareLocal' 对象没有多线程 cp 的属性 'connection'

创建于 2020-09-09  ·  7评论  ·  资料来源: GoogleCloudPlatform/gsutil

在使用系统 Python 3.7 的 macOS 上相当大的文件夹上运行gsutil -m cp -r gs://example/ ./时(以防止出现 #961 的问题),我看到以下错误的许多实例:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 788, in _callmethod
    conn = self._tls.connection
AttributeError: 'ForkAwareLocal' object has no attribute 'connection'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/gsutil/gslib/command.py", line 2348, in run
    cls = copy.copy(class_map[caller_id])
  File "<string>", line 2, in __getitem__
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 792, in _callmethod
    self._connect()
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/multiprocessing/managers.py", line 779, in _connect
    conn = self._Client(self._token.address, authkey=self._authkey)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 492, in Client
    c = SocketClient(address)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 619, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 61] Connection refused

结果,该命令在开始第一批下载后似乎挂起。

最有用的评论

-o " GSUtil:parallel_process_count=1 " 解决方法在 Big Sur (macOS 11.2) 上对我有效,但令我沮丧的是,这在 Mac 平台上仍然是一个问题。

所有7条评论

我在 OSX 10.15.6、gcloud {308.0.0、297.0.1}、gsutil {4.53、4.51}、python 3.7.8 中遇到了完全相同的问题。

在 OSX 10.15.7、gcloud 303.0.0、gsutil 4.52、python 3.6.5 中相同

在 gcloud 317.0.0、python 3.7.7 中相同

感谢您报告此事! 我也能够重现此错误,并发现禁用多处理有帮助。 您可以通过在 boto 配置文件的 GSUtil 部分中设置parallel_process_count=1来执行此操作,或者在命令中添加以下标志: -o "GSUtil:parallel_process_count=1" 。 尽管这会禁用多处理,但仍应启用多线程,因此您仍然可以并行传输。

我猜这个问题与 MacOS 上的多处理的更一般问题有关,PR #1107 让我们容易受到攻击(https://github.com/GoogleCloudPlatform/gsutil/pull/1107#issuecomment-698555319)。 如果您在禁用多处理后仍然遇到此问题,请告诉我们!

感谢您提供解决方法,它对我有用。

虽然这个工具是个玩笑。 没有一个版本,因为297在没有某种补丁的情况下开箱即用。

-o " GSUtil:parallel_process_count=1 " 解决方法在 Big Sur (macOS 11.2) 上对我有效,但令我沮丧的是,这在 Mac 平台上仍然是一个问题。

对我不起作用,我得到CommandException: Destination URL must name a directory, bucket, or bucket subdirectory for the multiple source form of the cp command.请修复你的笑话产品

此页面是否有帮助?
0 / 5 - 0 等级