Skip to content

Add support for parsing of TaskState#187

Merged
rst0git merged 12 commits intocheckpoint-restore:mainfrom
rst0git:task-state-parsing
Jan 17, 2026
Merged

Add support for parsing of TaskState#187
rst0git merged 12 commits intocheckpoint-restore:mainfrom
rst0git:task-state-parsing

Conversation

@rst0git
Copy link
Member

@rst0git rst0git commented Jan 13, 2026

When parsing the state of a checkpoint, we need to take into account the state of the PID we are analysing. This can be alive, stopped, dead, or zombie. In particular, only processes in alive and stopped task state have CRIU images for memory pages, open files, sockets, etc. This patch extends checkpointctl to display the TaskState of non-alive processes, and skip parsing the runtime state of dead or zombie tasks.

Example:

$ checkpointctl inspect --ps-tree-env /tmp/test.tar 

Displaying container checkpoint tree view from /tmp/test.tar

recursing_meninsky
├── Image: docker.io/library/python:3-alpine
├── ID: fa8e42820889e31fbd668b9c223542b815ee8436df59a92734079cb4bf1eadd4
├── Runtime: runc
├── Created: 2026-01-11T13:50:07Z
├── Engine: Podman
├── Checkpoint size: 3.5 MiB
│   └── Memory pages size: 3.5 MiB
├── Root FS diff size: 34.0 KiB
└── Process tree
    └── [1]  python3
        ├── Environment variables
        │   ├── PYTHON_VERSION=3.14.2
        │   ├── PYTHON_SHA256=ce543ab854bc256b61b71e9b27f831ffd1bfd60a479d639f8be7f9757cf573e9
        │   ├── PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        │   ├── container=podman
        │   ├── HOME=/root
        │   └── HOSTNAME=fa8e42820889
        └── [6 (Dead)]  python3
$ checkpointctl inspect --sockets /tmp/test.tar 

Displaying container checkpoint tree view from /tmp/test.tar

recursing_meninsky
├── Image: docker.io/library/python:3-alpine
├── ID: fa8e42820889e31fbd668b9c223542b815ee8436df59a92734079cb4bf1eadd4
├── Runtime: runc
├── Created: 2026-01-11T13:50:07Z
├── Engine: Podman
├── Checkpoint size: 3.5 MiB
│   └── Memory pages size: 3.5 MiB
├── Root FS diff size: 34.0 KiB
└── Process tree
    └── [1]  python3
        └── [6 (Dead)]  python3

This patch uses changes to go-criu from checkpoint-restore/go-criu#220

@rst0git
Copy link
Member Author

rst0git commented Jan 13, 2026

cc: @TusharMohapatra07

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

Test Results

61 tests  ±0   61 ✅ ±0   2s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 11d87da. ± Comparison against base commit a95931b.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.37%. Comparing base (45d1cc7) to head (11d87da).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/memparse.go 55.55% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #187      +/-   ##
==========================================
+ Coverage   74.14%   74.37%   +0.23%     
==========================================
  Files          13       13              
  Lines        1257     1284      +27     
==========================================
+ Hits          932      955      +23     
- Misses        251      253       +2     
- Partials       74       76       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TusharMohapatra07
Copy link
Contributor

I see! We had to propagate the task state to display dead/zombie state in process tree in the output. Thanks :)

@rst0git rst0git force-pushed the task-state-parsing branch 2 times, most recently from 2d44b90 to 5a1e201 Compare January 13, 2026 19:53
@rst0git rst0git force-pushed the task-state-parsing branch from 5a1e201 to 1b3f54a Compare January 15, 2026 11:39
@TusharMohapatra07
Copy link
Contributor

Hey @rst0git, out of curiosity, I’d appreciate it if you could explain the design choice behind moving the task states to the go-criu library. Thanks in advance :)

@rst0git
Copy link
Member Author

rst0git commented Jan 15, 2026

@TusharMohapatra07 The CRIT tool contains most of the code used for parsing CRIU images, and the Go version of this tool provides most of the core functionality used in checkpointctl. The problem described in #184 also occurs when parsing other image files: checkpoint-restore/go-criu@204cdf1

@TusharMohapatra07
Copy link
Contributor

Makes sense! Thank you so much :)

@rst0git rst0git force-pushed the task-state-parsing branch from 1b3f54a to d852724 Compare January 16, 2026 15:06
@rst0git rst0git marked this pull request as ready for review January 16, 2026 15:07
TusharMohapatra07 and others added 12 commits January 17, 2026 22:50
When parsing the state of a checkpoint, we need to take into account
the state of the PID we are analysing. This can be alive, stopped,
dead, or zombie. In particular, only processes in alive and stopped
task state have CRIU images for memory pages, open files, sockets, etc.

This patch extends checkpointctl to display the TaskState of non-alive
processes, and skip parsing the runtime state of dead or zombie tasks.

Signed-off-by: TusharMohapatra07 <tusharmohapatra.gig@gmail.com>
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Our tests check the content of specific lines in the output, and
we need to use consistent output for this to work.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Ensure use_tcp_socket is initialized to a known value.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
fork() returns pid_t, not bool.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Fix implicit declarations for socket, bind, listen, accept,
send, and recv.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Prevent undefined behavior caused by uninitialized padding
and unused fields in sockaddr_in.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Stop busy-looping when recv() returns 0 or -1.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Use correct string length and avoid sending unintended null byte.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Cast to char* before adding stack size to comply with C standard.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Check for errors when opening the log file before redirecting output.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
enable is already declared, so let's use it to improve readability.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
@rst0git rst0git force-pushed the task-state-parsing branch from d852724 to 11d87da Compare January 17, 2026 23:02
@rst0git rst0git merged commit 19e162b into checkpoint-restore:main Jan 17, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants