Commit Graph

105 Commits

Author SHA1 Message Date
Maksym Pavlenko 4ae8331ea1
Update dependencies
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-07-16 14:22:42 -07:00
zzzzzzzzzy9 15fbabcf8e Unmount the mount point of the container when the container is deleted.
Signed-off-by: zzzzzzzzzy9 <zhang.yu58@zte.com.cn>
2025-07-07 04:51:59 +00:00
Maksym Pavlenko 220d6d6a65
Fix runc dependency
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-06-30 10:09:42 -07:00
jokemanfire cea5523d20 fix(update): avoid update resource while the process is zombie
add a check in zombie init process

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-05-09 01:42:38 +00:00
jokemanfire 3b42040af2 optimize: use a more user-friendly interface in ttrpc
Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-04-15 03:41:12 +00:00
Jorge Prendes 2a098d9f69 re-enable cargo machete
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
2025-04-09 14:23:23 +00:00
Maksym Pavlenko ae876e3a33
Fix shim dependency
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-28 12:06:30 -08:00
jokemanfire 545b0e789e Add info for get runtimeinfo
This interface is already in goshim.
Use containerd-shim-runc-v2 --info.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-01-27 20:06:12 +00:00
Maksym Pavlenko bd5dd4fcbd
Remove unused fields
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-06 10:58:59 -08:00
Maksym Pavlenko 314e384806
Fix unused fields on MacOS
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2025-01-06 10:50:54 -08:00
jokemanfire 4133fef4c0 Optimize: refine the scope of the lock.
We can discard the lock before reporting the incident.According to Goshim.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-15 03:25:25 +00:00
jokemanfire a0f3bf13a1 Attemp to resolve fifo open deadlock
If long time no read side , may cause shim lock.
Avoid fifo open deadlock,use a easy timeout

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-13 20:04:38 +00:00
jokemanfire 6526c28e87 Prevent the init process from exiting and continuing with start
No need to wait for runc return an error

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-13 20:02:50 +00:00
jokemanfire eef8806871 fix process exit (not init) event not publish
1.add get id interface in process
2.add process event publish in service

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-11 20:10:31 +00:00
fengwei0328 1e17e1495e The task_dir successfully cleans when the file is absent
Signed-off-by: fengwei0328 <feng.wei8@zte.com.cn>
2024-12-06 18:54:16 +00:00
zzzzzzzzzy9 7051e312f5 if init is paused/pausing, exec state should be the same 2024-12-04 21:57:39 +00:00
ningmingxiao 8029a61a2b fix leftover shim processes 2024-12-03 23:34:03 +00:00
jokemanfire c6b623cb8b Attempt to change mutex to rwlock
In high concurrency environments, some operations are read-only and do not require mutex write locks.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-12-03 23:33:04 +00:00
jokemanfire 6d496ef7fa In delete: Process not found should not return ok
Compatible with goshim

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2024-11-19 19:31:22 +00:00
jokemanfire 6cb625da04 <rshim>Improve the events report
1.add timeout in ctx
2.add queue in publisher report
3.add reconnect client method
2024-10-30 23:14:55 +00:00
zzzzzzzzzy9 792c2e619e shim: Implement the pause and resume interfaces 2024-10-30 16:53:26 +00:00
Lei Liu c22dba6201 fix: remove meaningless input from other_error macro
Signed-off-by: Lei Liu <liulei.pt@bytedance.com>
2024-10-30 00:05:16 +00:00
jiaxiao zhou 217f0ee935 Cargo.toml: remove unused dependnecies
Signed-off-by: jiaxiao zhou <duibao55328@gmail.com>
2024-09-23 17:03:41 +00:00
jokemanfire 7519a0161e If parse arguments error do not panic, just exit without zero 2024-09-18 16:43:40 +00:00
zzzzzzzzzy9 71de1b435d process_info should be ProcessDetails, otherwise it can't be parsed 2024-09-03 18:21:15 +00:00
zzzzzzzzzy9 0911c1cfff When get_container return an error, just return pid=0 to connect interface 2024-08-03 02:59:27 +00:00
Bryant Biggs 3a9ceb351f chore: Update `nix` package to latest 2024-08-02 19:28:24 +00:00
zzzzzzzzzy9 288cc8082d add process info to pids() interface 2024-08-02 16:29:04 +00:00
张钰10307750 b308d13c28 add pid to delete response 2024-08-02 16:21:03 +00:00
Bryant Biggs e771f15ce2 fix: Correct clippy lint suggestion part deux 2024-07-30 16:54:34 +00:00
Bryant Biggs ab17df086a chore: Fix whitespace 2024-07-30 16:54:34 +00:00
Bryant Biggs 303b2e3009 chore: Fix cargo deny failed checks and de-duplicate crates using workspace shared dependency 2024-07-30 16:54:34 +00:00
James Sturtevant c696ce477d Release fix for cgroup parsing
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-19 21:25:23 +00:00
James Sturtevant 798ab74d20 Release 0.7.0 of Shim and 0.5.0 of client
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-13 19:20:17 +00:00
James Sturtevant 9c375635b6 Remove depreciated functions
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2024-03-12 05:03:06 +00:00
Qiao 21973bd49e add oom monitor for rustshim 2024-03-06 20:29:02 +00:00
zhang yu 10307750 3a7b9ce173 feat: set THP_DISABLE=true in shim, and restore it before starting runc
If /sys/kernel/mm/transparent_hugepage/enabled=always, the shim process
will use huge pages, which will consume a lot of memory.

Just like this:
ps -efo pid,rss,comm | grep shim
    PID   RSS COMMAND
   2614  7464 containerd-shim

I don't think shim needs to use huge pages, and if we turn off the huge
pages option, we can save a lot of memory resources.

After we set THP_DISABLE=true:
ps -efo pid,comm,rss
    PID COMMAND           RSS
1629841 containerd-shim  5648

containerd
    |
    |--shim1   --start
        |
        |--shim2    (this shim will on host)
            |
            |--runc create (when containerd send create request by ttrpc)
                |
                |--runc init (this is the pid 1 in container)

    we should set thp_disabled=1 in shim1 --start, because if we set this
    in shim 2, the huge page has been setted while func main() running,
    we set thp_disabled cannot change the setted huge pages.
    So We need to set thp_disabled=1 in shim1 so that shim2 inherits the
    settings of the parent process shim1, and shim2 has closed the
    hugepage when it starts.

    For runc processes, we need to set thp_disabled='before' in shim2 after
    fork() and before execve(). So we use cmd.pre_exec to do this.
2024-02-20 02:43:24 +00:00
James Sturtevant fca511e235 Create v0.6.0 release of containerd-shim and shim-protos
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2023-10-30 18:05:57 +00:00
Maksym Pavlenko e8ad07d5fd
Update nix crate
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-10-05 11:37:27 -07:00
Bryant Biggs 5e1b7760a1 chore: Standardize Cargo.toml files, enable more workspace dependencies 2023-09-21 13:04:22 -04:00
James Sturtevant fd1b235913 Bump the version for shim protos and containerd-shim
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2023-08-24 16:40:16 +00:00
jiaxiao zhou deea90ff83
feat(runc-shim): add a version flag
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2023-08-21 21:45:01 +00:00
Maksym Pavlenko f1d2500c1f Fix docs link
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-08-08 10:07:45 -07:00
Maksym Pavlenko 77a2b87c18 [runc-shim] Move async code to package root
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-08-08 10:07:45 -07:00
Maksym Pavlenko 53cc80da4d Remove sync runc shim
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-08-08 10:07:45 -07:00
Maksym Pavlenko 27a503a474 [shim] Bump version to 0.4
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-08-02 12:37:35 -07:00
Tianyang Zhang 7817d7ef7b runc-shim: open read side of stdout/stderr fifo to avoid EPIPE
The "read" side of container stdout/stderr fifo has been opened
by containerd and on the other hand "write" side is opened by
container process, which is a little different with golang shim.
If containerd shutdown and closed the read fd, container process
will receive EPIPE when writing to stdout/stderr and then be
killed by SIGPIPE signal. In this commit, the "read" side is
opened again by shim so that at least there is one opened "read"
side all the time.

Signed-off-by: Tianyang Zhang <burning9699@gmail.com>
2023-07-21 17:12:16 +08:00
James Sturtevant 60558b7848 Pass all commandline arguments through
Because the second invocation of the shim doesn't have the containerd pipe passed to it, a shim that wants to communicate over the pipe needs to parse the arguments its own.  This makes it so the library pass all the arguments, which has already parsed the arguments allowing shims to use the containerd address.

Signed-off-by: James Sturtevant <jstur@microsoft.com>
2023-07-20 21:43:23 +00:00
Maksym Pavlenko e3c2364587
Merge pull request #138 from Burning1020/ttyfd-close
runc-shim: fix tty fd multi close error
2023-04-23 19:25:59 +02:00
Zhang Tianyang ad90c998ef runc-shim: fix tty fd multi close error
use File::from_raw_fd() to create the tty io file, when the io copy
thread ends, it will drop the file object which will close the fd, but
as we made three file objects from the same fd, it will be closed
three times, if other opened files occupied this fd number, the
second or third drop of the file object may close the fds of other files.

Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2023-04-11 20:16:39 +08:00