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

Fix a panic when spawning the sidecar worker. #366

Merged
merged 3 commits into from
Mar 26, 2024
Merged

Conversation

iamluc
Copy link
Contributor

@iamluc iamluc commented Mar 21, 2024

What does this PR do?

Fix a panic when spawning the sidecar worker.

Motivation

Discovered while running a linux/amd64 build of dd-trace-php in a Docker container on a Mac M1 machine.

panic details:

thread '<unnamed>' panicked at 'No such file or directory (os error 2)', libdatadog/spawn_worker/src/unix/spawn.rs:441:21 stack backtrace:
   0: rust_begin_unwind
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
   2: core::panicking::panic_display
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:150:5
   3: spawn_worker::unix::spawn::SpawnWorker::do_spawn::{{closure}}
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panic.rs:56:9
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1999:9
   5: spawn_worker::unix::spawn::SpawnWorker::do_spawn
             at ./libdatadog/spawn_worker/src/unix/spawn.rs:575:9
   6: spawn_worker::unix::spawn::SpawnWorker::spawn
             at ./libdatadog/spawn_worker/src/unix/spawn.rs:305:19

Additional Notes

Credit goes to @bwoebi for the fix

How to test the change?

Tested locally using the PHP system-tests

For Reviewers

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Discovered while running a linux/amd64 build of dd-trace-php in a Docker container on a Mac M1 machine.

panic details:
thread '<unnamed>' panicked at 'No such file or directory (os error 2)', libdatadog/spawn_worker/src/unix/spawn.rs:441:21
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
   2: core::panicking::panic_display
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:150:5
   3: spawn_worker::unix::spawn::SpawnWorker::do_spawn::{{closure}}
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panic.rs:56:9
   4: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/boxed.rs:1999:9
   5: spawn_worker::unix::spawn::SpawnWorker::do_spawn
             at ./libdatadog/spawn_worker/src/unix/spawn.rs:575:9
   6: spawn_worker::unix::spawn::SpawnWorker::spawn
             at ./libdatadog/spawn_worker/src/unix/spawn.rs:305:19

Credit goes to @bwoebi for the fix
@iamluc iamluc requested a review from a team as a code owner March 21, 2024 11:36
Copy link
Contributor

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this. It leaks a fd, but a fd to the TXT segment, which is fine.
And will ensure that fexecve works with custom binfmts (rosetta or qemu).

@bwoebi bwoebi merged commit 1ff1bfe into main Mar 26, 2024
20 checks passed
@bwoebi bwoebi deleted the lv/fix-spawn-panic branch March 26, 2024 15:14
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