When running CPython 3.11 workloads on Fargate, CodeGuru Profiler sometimes crashes:
2023-11-14 20:27:16,412 - codeguru_profiler_agent.profiler_runner - INFO - An unexpected issue caused the profiling command to terminate.
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/profiler_runner.py", line 74, in _profiling_command
sample_result = self._run_profiler()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/metrics/with_timer.py", line 26, in timed
result = fn(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/profiler_runner.py", line 98, in _run_profiler
self._sample_and_aggregate()
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/metrics/with_timer.py", line 26, in timed
result = fn(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/profiler_runner.py", line 103, in _sample_and_aggregate
sample = self.sampler.sample()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/metrics/with_timer.py", line 26, in timed
result = fn(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/sampler.py", line 46, in sample
stacks = self._get_stacks(
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/sampling_utils.py", line 34, in get_stacks
stacks.append(_extract_frames(end_frame, max_depth))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/sampling_utils.py", line 114, in _extract_frames
stack_entries = _extract_stack(stack, max_depth)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/sampling_utils.py", line 76, in _extract_stack
_maybe_append_synthetic_frame(result, last_frame, last_frame_line_no)
File "/usr/local/lib/python3.11/site-packages/codeguru_profiler_agent/sampling_utils.py", line 100, in _maybe_append_synthetic_frame
line = linecache.getline(frame.f_code.co_filename, line_no).strip()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/linecache.py", line 31, in getline
if 1 <= lineno <= len(lines):
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'int' and 'NoneType'