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

Use poll-based approach to subscribe to file changes #463

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fatanugraha
Copy link
Contributor

@fatanugraha fatanugraha commented Jan 21, 2025

I'm not entirely sure whether this is an acceptable workaround to the issue or not, but I don't see other way for us to use the latest version without fixing the bug in upstream.

Fixes #462

Copy link
Contributor

openshift-ci bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fatanugraha
Once this PR has been reviewed and has the lgtm label, please assign baude for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fatanugraha fatanugraha force-pushed the main branch 11 times, most recently from ca5d9ab to e6ba620 Compare January 21, 2025 17:46
@fatanugraha fatanugraha changed the title Use poll based file watcher Downgrade fsnotify to 1.6.0 Jan 21, 2025
@fatanugraha fatanugraha force-pushed the main branch 6 times, most recently from 2a2c889 to 0963cb5 Compare January 21, 2025 18:31
@fatanugraha
Copy link
Contributor Author

fatanugraha commented Jan 21, 2025

the new test is passing on darwin but not on linux. In linux, inotify won't detect changes of the link destination inside the monitored directory.

maybe fixing the actual bug in upstream is easier than working around it 😂

@cfergeau
Copy link
Collaborator

the new test is passing on darwin but not on linux. In linux, inotify won't detect changes of the link destination inside the monitored directory.

maybe fixing the actual bug in upstream is easier than working around it 😂

Or we can do both, have a fix upstream, but have a workaround until the fix is merged.

@fatanugraha fatanugraha force-pushed the main branch 2 times, most recently from 2af050d to 95da137 Compare January 22, 2025 13:54
@fatanugraha
Copy link
Contributor Author

but have a workaround until the fix is merged.

Yeah, i can't think of any easy workaround for the fsnotify bug so i'm just going to use poll-based approach to subscribe to the change event.

was considering to just have a for loop + os.Read for simplicity but i guess the current approach might be way cheaper when the file that we watched rarely changed (which i think is the case for us).

@fatanugraha fatanugraha changed the title Downgrade fsnotify to 1.6.0 Use poll-based approach to subscribe to the file changes Jan 22, 2025
@fatanugraha fatanugraha changed the title Use poll-based approach to subscribe to the file changes Use poll-based approach to subscribe to file changes Jan 22, 2025
fsnotify/fsnotify can't watch a folder that contains a symlink into
a socket or named pipe.

Use poll-based mechanism to watch the file for the time being until
we find a better way or fix the issue in the upstream.

Signed-off-by: Fata Nugraha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when start watching folder containing resolv.conf
2 participants