Repository navigation
Closed
Description
While running a benchmark on MacOS using the following command:
./pkb.py --cloud=Azure --benchmarks=kubernetes_hpa --kubectl=$(which kubectl) --kubeconfig=$HOME/config --accept_licenses --zone centralus
an error occurs:
2025-07-11 12:00:24,909 b89c560b MainThread kubernetes_hpa(1/1) ERROR Exception running benchmark
Traceback (most recent call last):
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/pkb.py", line 1368, in RunBenchmarkTask
RunBenchmark(spec_for_run, collector)
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/pkb.py", line 1080, in RunBenchmark
DoProvisionPhase(spec, detailed_timer)
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/pkb.py", line 670, in DoProvisionPhase
spec.Provision()
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/benchmark_spec.py", line 898, in Provision
self.container_cluster.Create()
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/container_service.py", line 1545, in Create
super().Create(restore)
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/resource.py", line 401, in Create
self._PostCreate()
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/providers/azure/azure_kubernetes_service.py", line 306, in _PostCreate
super()._PostCreate()
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/container_service.py", line 1552, in _PostCreate
self.event_poller.StartPolling()
File "$HOME/repos/PerfKitBenchmarker/perfkitbenchmarker/container_service.py", line 1490, in StartPolling
self.event_poller.start()
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/context.py", line 288, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "$HOME/.pyenv/versions/3.11.13/lib/python3.11/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'KubernetesCluster.__init__.<locals>._GetEventsNoLogging'
2025-07-11 12:00:24,912 b89c560b MainThread kubernetes_hpa(1/1) ERROR Benchmark 1/1 kubernetes_hpa (UID: kubernetes_hpa0) failed. Execution will continue.
Versions:
ProductName: macOS Sequoia
ProductVersion: 15.5
BuildVersion: 24F74
Python 3.11.13
Activity
anksena commentedon Jul 29, 2025
Have tested any other benchmark on Mac OS ?
vofish commentedon Jul 30, 2025
Yes, I have. This also doesn't work:
./pkb.py --benchmarks=kubernetes_scaleAs a workaround, you can add the following line:
multiprocessing.set_start_method("fork", force=True)after the statement:
from multiprocessing import synchronizeto thePerfKitBenchmarker/perfkitbenchmarker/container_service.py
Line 33 in ba003ee
hubatish commentedon Sep 5, 2025
For @vofish or @kiryl-filatau , it looks like we should be able to detect the operating system:
https://stackoverflow.com/questions/1854/how-to-identify-which-os-python-is-running-on
& then can run the multiprocessing set_start_method command. This would be best done at runtime in pkb.py somewhere - maybe the Main function, rather than hidden in an import statement. Feel free to send such a PR so you don't need to keep this code locally on your machine.
python in general is moving towards spawn.. so I'm not 100% sure this is overall the right solution, as opposed to solving the pickling problem. But internally we always use linux so a gate on OS would solve this problem for y'all without effecting us.
Fix issue GoogleCloudPlatform#5883
vofish commentedon Sep 11, 2025
@anksena @hubatish
Please review PR#6055 fixing this issue
vofish commentedon Sep 17, 2025
Fixed