Skip to content

Conversation

@ptarjan
Copy link
Contributor

@ptarjan ptarjan commented Dec 30, 2025

When running in a PID namespace (common in containers), watchman fails
with "need /proc to be mounted!" because it accesses /proc//fd/X
using the namespace PID, but /proc may be mounted from the host with
different PID numbering.

The fix is to use /proc/self/fd/X instead of /proc/<getpid()>/fd/X
when resolving file descriptor paths. The /proc/self symlink is always
resolved by the kernel to the current process's /proc entry, regardless
of PID namespace boundaries.

This issue manifests when:

  • Process is in a PID namespace (e.g., Docker container)
  • /proc is mounted from host or a different namespace
  • watchman tries to resolve paths via /proc//fd

Error seen:
getOpenedPath: need /proc to be mounted!: Function not implemented

Affected platforms: Linux containers with PID namespace isolation

Simplify the procfs path construction by using /proc/self which is a
symlink to the current process's directory, avoiding the need to call
folly::get_cached_pid(). This also removes the now-unused Pid.h include.
@meta-cla meta-cla bot added the CLA Signed label Dec 30, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 30, 2025

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D89913463. (Because this pull request was imported automatically, there will not be any future comments.)

@facebook-github-bot
Copy link
Contributor

@ptarjan has updated the pull request. You must reimport the pull request before landing.

@ptarjan ptarjan force-pushed the claude/use-proc-self-soRMK branch from 47d6bdd to d6a0213 Compare December 30, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants