Skip to content

Race with golang exec #272

@linxiulei

Description

@linxiulei

Before reporting an issue, please ensure you are using the latest release of fsnotify.

Which operating system (GOOS) and version are you using?

Linux: CentOS7 x86_64

Please describe the issue that occurred.

A race happened when Fsnotify created pipe and epollfd, which didn't live with golang exec. It would lead to unintended fd inheritance. Please checkout https://github.com/golang/go/blob/c659be4dc862cdf14a24134f2cfc16fa81e6d84c/src/os/file_unix.go#L190

Are you able to reproduce the issue? Please provide steps to reproduce and a code sample if possible.

Simply insert codes like below after creating a fsnotify watcher

cmd := exec.Command("sleep", "1000")
cmd.Start()

and checkout /proc/${sleep_pid}/fd, there would be file descriptions inherited from the parent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions