Skip to content

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

Merged
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
fatanugraha:main
Jan 28, 2025
Merged

Use poll-based approach to subscribe to file changes#463
openshift-merge-bot[bot] merged 1 commit intocontainers:mainfrom
fatanugraha:main

Conversation

@fatanugraha
Copy link
Copy Markdown
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

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 <fatanugraha@outlook.com>
Copy link
Copy Markdown
Collaborator

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested and works fine

@cfergeau
Copy link
Copy Markdown
Collaborator

/lgtm
/approve
@evidolob you can use the 2 commands above on PRs you want to merge. A bot will then take care of the merging (can take a few hours)

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jan 28, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfergeau, evidolob, fatanugraha, lstocchi

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [cfergeau,evidolob,lstocchi]

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

@openshift-merge-bot openshift-merge-bot bot merged commit c9dd0cb into containers:main Jan 28, 2025
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.

Error when start watching folder containing resolv.conf

4 participants