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

High CPU usage #237

Closed
Cosby86 opened this issue Feb 22, 2018 · 4 comments · Fixed by #480
Closed

High CPU usage #237

Cosby86 opened this issue Feb 22, 2018 · 4 comments · Fixed by #480
Labels

Comments

@Cosby86
Copy link

Cosby86 commented Feb 22, 2018

Hello all,
I have a file, monitored by fsnotify, in used from another process and I have a leak of CPU (attached pprof diagram). What do you think about it?
capture

@hwhe

This comment was marked as off-topic.

@wweir
Copy link

wweir commented Nov 26, 2018

I ran into the same situation on the Mac platform. After I extended the timeout, the situation disappeared.
This is my pr #276

@paulquerna-okta
Copy link

fixed by #262 as well

@nathany nathany added the freebsd label Oct 5, 2019
@dmt0

This comment was marked as duplicate.

arp242 added a commit that referenced this issue Aug 1, 2022
The timeout for unix.Kevent() is causing issues; every 100ms it will do a new
unix.Kevent() syscall, which isn't too efficient: even if you have just one
change an hour, you will still keep calling kevent() ten times per second,
resulting in a needlessly high CPU usage.

Without a timeout, kevent() will block indefinitely until there are some events,
which is much more efficient. We can't just remove the timout however, since we
can't interrupt the kevent() call on FreeBSD and NetBSD, and it will hang
forever. This issue is described in more detail here:
#262 (comment)

To solve this we register a new kevent() with the file descriptor set to the
closepipe; when this pipe is closed an event is sent and kevent() will stop
blocking.

This is a rebased version of #124.

Fixes #89
Fixes #237
Fixes #333
Supersedes and closes #124
Supersedes and closes #262
Supersedes and closes #334
@arp242 arp242 closed this as completed in 4b43fad Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants