GoogleCloudPlatform / GoogleCloudPlatform/gsutil
gsutil fails sporadically on macOS
- Dominant language
- Python
- Stars
- 918
- Forks
- 335
- PR merge metrics
- No merged PRs in 30d
Description
On my Mac (MacBookPro14,3; macOS HighSierra), gsutil (v 4.34) fails sproradically with the following trace:
```
Traceback (most recent call last):
File "/Users//google-cloud-sdk/platform/gsutil/gsutil", line 22, in
gsutil.RunMain()
File "/Users//google-cloud-sdk/platform/gsutil/gsutil.py", line 117, in RunMain
sys.exit(gslib.__main__.main())
File "/Users//google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 250, in main
command_runner = CommandRunner()
File "/Users//google-cloud-sdk/platform/gsutil/gslib/command_runner.py", line 146, in __init__
self.command_map = self._LoadCommandMap()
File "/Users//google-cloud-sdk/platform/gsutil/gslib/command_runner.py", line 152, in _LoadCommandMap
__import__('gslib.commands.%s' % module_name)
File "/Users//google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 43, in
from gslib.utils import copy_helper
File "/Users//google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 168, in
if CheckMultiprocessingAvailableAndInit().is_available else None))
File "/Users//google-cloud-sdk/platform/gsutil/gslib/utils/parallelism_framework_util.py", line 84, in __init__
self.lock = manager.Lock()
File "/Users//.pyenv/versions/2.7.15/lib/python2.7/multiprocessing/managers.py", line 670, in temp
authkey=self._authkey, exposed=exp
File "/Users//.pyenv/versions/2.7.15/lib/python2.7/multiprocessing/managers.py", line 733, in __init__
self._incref()
File "/Users//.pyenv/versions/2.7.15/lib/python2.7/multiprocessing/managers.py", line 783, in _incref
conn = self._Client(self._token.address, authkey=self._authkey)
File "/Users//.pyenv/versions/2.7.15/lib/python2.7/multiprocessing/connection.py", line 175, in Client
answer_challenge(c, authkey)
File "/Users//.pyenv/versions/2.7.15/lib/python2.7/multiprocessing/connection.py", line 437, in answer_challenge
response = connection.recv_bytes(256) # reject large message
IOError: bad message length
```
When I modify ```gslib/utils/parallelism_framework_util.py``` to prohibit multiprocessing a la Windows, this works fine. I see there is a mod for Alpine Linux (https://github.com/GoogleCloudPlatform/gsutil/commit/d7493e711e5b1c1937d0e57a25544bfba2641eb4). Does something similar need to be done for macOS? I modified the max number of open files and that seemed to help some but did not entirely address the problem.
To reproduce, run a `gsutil` command from the command line several times (even `gsutil -v` will break for me, but `ls` and `cp` seem to fail more often). At some point you should see the trace. I only see this problem in macOS. Ubuntu 18.04, for example, is fine.
Contributor guide
Research direction
Start with gslib/utils/parallelism_framework_util.py and the traceback through copy_helper.py and command_runner.py, then compare its platform handling with commit d7493e711e5b1c1937d0e57a25544bfba2641eb4. Reproduce by running gsutil commands repeatedly on macOS High Sierra, especially ls and cp; done means the intermittent IOError no longer occurs without disabling multiprocessing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, python
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100