pyroscope-rs icon indicating copy to clipboard operation
pyroscope-rs copied to clipboard

pyspy broken stacktrace during module import

Open korniltsev opened this issue 2 years ago • 0 comments

import logging
import time
logger = logging.getLogger()

logger.setLevel(logging.DEBUG)


def run_one():
    import pyroscope

    pyroscope.configure(
        enable_logging=True,
        application_name       = "simple.python.app",
        server_address = "http://127.0.0.1:4100",
    )



    time.sleep(1)

    import importlib
    from kubernetes import client, config, watch
    time.sleep(1)
    # importlib.reload(client)
    # importlib.reload(config)
    # importlib.reload(watch)
    # del client
    # del config
    # del watch

import os
for i in range(400):
    pid = os.fork()
    if pid > 0:
        continue
    else:
        run_one()
        exit(1)
        

produces something like this:


<frozen importlib._bootstrap>:228 - _call_with_frames_removed;<frozen importlib._bootstrap>:228 - _call_with_frames_removed;<frozen importlib._bootstrap_external>:850 - exec_module;<frozen importlib._bootstrap>:697 - _load_unlocked;<frozen importlib._bootstrap>:996 - _find_and_load_unlocked;<frozen importlib._bootstrap>:228 - _call_with_frames_removed;<frozen importlib._bootstrap>:228 - _call_with_frames_removed;__doc__:0 - Utility class to read content of obj[%data_key_name] or file's
     content of obj[%file_key_name] and represent it as file or data.
     Note that the data is preferred. The obj[%file_key_name] will be used iff
     obj['%data_key_name'] is not set or empty. Assumption is file content is
     raw data and data field is base64 string. The assumption can be changed
     with base64_file_content flag. If set to False, the content of the file
     will assumed to be base64 and read as is. The default True value will
     result in base64 encode of the file content after read.;<frozen importlib._bootstrap>:1007 - _find_and_load;<frozen importlib._bootstrap>:996 - _find_and_load_unlocked;<frozen importlib._bootstrap>:697 - _load_unlocked;<frozen importlib._bootstrap_external>:850 - exec_module;<frozen importlib._bootstrap_external>:978 - get_code;<frozen importlib._bootstrap_external>:1040 - get_data 1
     

korniltsev avatar Jul 07 '23 12:07 korniltsev