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

@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
@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 a78cbe5 to d6a0213 Compare January 5, 2026 00:52
@ptarjan
Copy link
Contributor Author

ptarjan commented Jan 5, 2026

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

I'm doing this to re-run the flaky test

@facebook-github-bot
Copy link
Contributor

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

1 similar comment
@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 47b33ef to d6a0213 Compare January 7, 2026 06:54
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.
@ptarjan ptarjan force-pushed the claude/use-proc-self-soRMK branch from d6a0213 to aeb760a Compare January 7, 2026 07:04
@facebook-github-bot
Copy link
Contributor

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

@ptarjan
Copy link
Contributor Author

ptarjan commented Jan 7, 2026

I'm giving up on CI. It is failing on main. The code compiles and works on my machine and I tested in my fleet and it works great.

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