about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <vorner@vorner.cz>2019-05-01 15:57:02 +0200
committerMichal 'vorner' Vaner <vorner@vorner.cz>2019-05-01 17:46:30 +0200
commit26199a27ffe777db9bfbff32e7ff8f5e4c7dde4c (patch)
tree9ca8b6cdd9d8f8c7004555665990e7857a1a4710 /src/libstd
parent47e0803d5c2ad5952220f2c260d7e12921c1d3fe (diff)
downloadrust-26199a27ffe777db9bfbff32e7ff8f5e4c7dde4c.tar.gz
rust-26199a27ffe777db9bfbff32e7ff8f5e4c7dde4c.zip
doc: Warn about possible zombie apocalypse
Extend the std::process::Child docs with warning about possible zombies.
The previous version mentioned that when dropping the Child, the
process is not killed. However, the wording gave the impression that
such behaviour is fine to do (leaving the reader believe low-level
details like reaping zombies of the dead processes is taken over by std
somehow; or simply leaving the reader unaware about the problem).
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/process.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index c1addb46a0a..6e4c6e4c366 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -134,6 +134,18 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
 /// the parent process wait until the child has actually exited before
 /// continuing.
 ///
+/// # Warning
+///
+/// On some system, calling [`wait`] or similar is necessary for the OS to
+/// release resources. A process that terminated but has not been waited on is
+/// still around as a "zombie". Leaving too many zombies around may exhaust
+/// global resources (for example process IDs).
+///
+/// The standard library does *not* automatically wait on child processes (not
+/// even if the `Child` is dropped), it is up to the application developer to do
+/// so. As a consequence, dropping `Child` handles without waiting on them first
+/// is not recommended in long-running applications.
+///
 /// # Examples
 ///
 /// ```should_panic