Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memray ERROR: Invalid record subtype when creating new Thread in v.1.13.4 #674

Open
1 task done
bore-741 opened this issue Sep 4, 2024 · 4 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@bore-741
Copy link

bore-741 commented Sep 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

No response

Expected Behavior

No response

Steps To Reproduce

1.os is linux
2.run with command :memray run -f --follow-fork -m my module
3.Before creating a new thread, memray can analyze the profile file normally. After creating a new thread, memray summary/stats/flamegraph, etc. will prompt ⠋ Computing statistics... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--Memray ERROR: Invalid record subtype

Memray Version

1.13.4

Python Version

3.7

Operating System

Linux

Anything else?

No response

@bore-741 bore-741 added the bug Something isn't working label Sep 4, 2024
@pablogsal
Copy link
Member

Can you please give us the code in "my_module" so we can try to reproduce on our end?

@MatteoMeil
Copy link

MatteoMeil commented Oct 9, 2024

I encountered the same error while profiling an Azure Function locally.

In the following, I provide steps to reproduce this issue with some Python code that mimics the real scenario in which, a memory-intensive task is submitted to a ProcessPoolExecutor. The function memory_intensive_task_async must be async per project requirements thus, it has been wrapped in asyncio.run

To reproduce

  1. Clone example code:
  2. Build Docker image and start a container:
    $ cd /path/to/memray-record-subtype-error-example
    $ docker build . -t memray-record-subtype-error-example
    $ docker run -d --name memray-error-example memray-record-subtype-error-example
  3. Spawn a bash, inspect processes and attach memray to running python process:
    $ docker exec -it memray-error-example /bin/bash
    $ ps aux  # look for python process, typically PID 39 or 40
    $ python -m memray attach PID -o memray_profile.bin
  4. Make a HTTP request to function from bash spawned at bullet 3:
    $ curl http://localhost/api/my_trigger
  5. Detach memray and generate flamegraph:
    $ python -m memray detach PID
    $ python -m memray flamegraph memray_profile.bin

Result

During flamegraph generation, memray raises an error:

 Calculating high watermark... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--Memray ERROR: Invalid record subtype

Memray Version

1.14.0

Operating System

Linux

Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Python Version

3.12.2

@pablogsal
Copy link
Member

I tried to reproduce this but I wasn't able to do so. Partially because the setup is so complicated and requires several layers. Could you please provide a reproducer that doesn't rely on the azure runtime?

@MatteoMeil
Copy link

MatteoMeil commented Nov 27, 2024

@pablogsal updated my comment above with simplified steps: basically I created an example and put in a repository. You'll only need to create and start a Docker container as described in the steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants