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

Do not transmit pid 0 as the target pid #1087

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- Target pid watcher will not report 0 for containers.

## [0.23.4]
### Added
- Introduced logrotate_fs, a sub-generator of `file_gen` that exposes a FUSE
Expand Down
11 changes: 11 additions & 0 deletions lading/src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ impl Server {
let pid: i64 = loop {
if let Ok(container) = docker.inspect_container(&config.name, None).await {
if let Some(pid) = container.state.and_then(|state| state.pid) {
// In some cases docker will report pid 0 as the pid for the
// polled container. This is not usable by us and we believe
// a race condition.
if pid == 0 {
info!(
"Found container with name {name} but with pid {pid}. Polling.",
name = config.name
);
time::sleep(Duration::from_secs(1)).await;
continue;
}
break pid;
}
} else {
Expand Down
Loading