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

Add a polling fallback to filesystem watcher #254

Closed
wants to merge 1 commit into from

Conversation

rgm
Copy link
Contributor

@rgm rgm commented Jul 7, 2020

Changes to the latest beta version of macOS broke the mechanism that we're using to observe filesystem change events. It's more than just filesystem observation that has broken: any attempt to run a hot-reloading workflow crashes the Figwheel process with an uncaught exception at startup. (Note that build-once still works, since it doesn't try to access filesystem events).

The underlying hawk library does have an implementation of a less-efficient polling watcher. Figwheel can use this to provide hot-reloading even when native events aren't available.

This commit wraps the hawk.core/watch! function to catch any exception that's thrown, and re-try with the same options except that it explicitly starts a polling watcher.

See also

Part of #253.

Changes to the latest beta version of macOS broke the mechanism that
we're using to observe filesystem change events. It's more than just
filesystem observation that has broken: any attempt to run a
hot-reloading workflow crashes the Figwheel process with an uncaught
exception at startup. (Note that build-once still works, since it
doesn't try to access filesystem events).

The underlying hawk library does have an implementation of a
less-efficient polling watcher. Figwheel can use this to provide
hot-reloading even when native events aren't available.

This commit wraps the `hawk.core/watch!` function to catch any exception
that's thrown, and re-try with the same options *except* that it
explicitly starts a polling watcher.

See also

- gjoseph/BarbaryWatchService#13
- java-native-access/jna#1216

Part of bhauman#253.
@rgm rgm marked this pull request as draft July 7, 2020 04:14
@rgm
Copy link
Contributor Author

rgm commented Jul 7, 2020

@bhauman what do you think: close this one, in favour of the {:hawk-options ,,,} fix?

@bhauman
Copy link
Owner

bhauman commented Jul 7, 2020 via email

@rgm
Copy link
Contributor Author

rgm commented Jul 8, 2020

Closing without merge; everyone just use the {:hawk-options {:watcher :polling}} temporary fix described in #253 (comment).

@rgm rgm closed this Jul 8, 2020
@rgm rgm deleted the add-polling-fallback branch July 8, 2020 01:16
@sankara
Copy link

sankara commented Aug 22, 2020

FYI. This may or may not be relevant to you - I had a similar issue with another library that was also using hawk to monitor file changes. I was borrowing your code to see if that fixed it. While testing, I got a java.lang.UnsatisfiedLinkError. It's an Error and doesn't extend Exception. I had to catch an Error to fix it.

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.

3 participants