-
Notifications
You must be signed in to change notification settings - Fork 493
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
Resources are no longer watched after modifying through IntelliJ #596
Comments
To make it more interesting, if the modified resource is directly in |
try to add following line to hotswap-agent.properties in your application resources/
you should see sequence of WATCH EVENTS generated by Idea deployment and compare it to |
Inside IntelliJ it is the above mentioned rows
and outside (
I think IntelliJ does something like
when updating the files, which causes similar logs as with IntelliJ |
Is the "Hotswap Watcher" thread still running after it stops responding? |
The watcher thread keeps running and only the listener for the Also, if you do the command slowly, step by step, the output is quite different:
|
What OS are you using? |
macOS 15.0 aka sequoia |
There is WatcherNIO2Test in HA core, I've tried to simulate your problem, and don't see some events on Linux, too. @Test
public void recreateDirFile() throws IOException {
final ResultHolder resultHolder = new ResultHolder();
Path testDir = temp.resolve("testdir");
Files.createDirectories(testDir);
File testFile = new File(testDir.toFile(), "testfile.txt");
testFile.createNewFile();
watcher.addEventListener(null, temp.toUri(), new WatchEventListener() {
@Override
public void onEvent(WatchFileEvent event) {
System.out.println(event.toString());
// assertEquals("New file event type", FileEvent.CREATE, event.getEventType());
// assertTrue("File name", event.getURI().toString().endsWith("testfile.txt"));
resultHolder.result = true;
}
});
//assertTrue("Event listener called", waitForResult(resultHolder));
Files.walk(testDir)
.sorted(Comparator.reverseOrder())
.forEach(path -> {
try {
Files.delete(path);
} catch (IOException e) {
e.printStackTrace();
}
});
Files.deleteIfExists(testDir);
Files.createDirectories(testDir);
testFile = new File(testDir.toFile(), "testfile.txt");
testFile.createNewFile();
assertTrue("Event listener called", waitForResult(resultHolder));
} |
Problem is in |
There is a fix for it in the master + junit test. Could you check it please? |
Based on a quick test, it works perfectly. The output is
and nothing else |
Added LOG for fake events, you should see ENTRY_CREATE event |
Otherwise, this change breaks the Spring plugin tests, the other plugins remain unaffected. |
Tests are fixed now. |
There may be a similar problem on Windows, as it uses a different implementation of Watcher. Have you had the opportunity to test your issue on Windows? |
I tried in a virtual machine with Windows 11 and don't see the original issue with HA 2.0.1. It logs
and the watcher keeps working |
Now when testing some more on Mac, there are still some issues. Either I am testing it wrong or something is still bugging. With the latest
and then on subsequent changes only
there are no modify events for the file itself and manually doing |
I don't get it. Now it works like yesterday again... I wonder if there is a timing issue still somewhere |
Could you make simple example for testing? |
If I have a resource, say
src/main/resources/vaadin-i18n/translations.properties
containingfoo=bar
, then when running with HotswapAgent and doingtriggers hotswap events for file reload, triggers the Vaadin plugin etc. Just like expected.
However, if you in IntelliJ open the file, change it to
foo=baz
and pressBuild -> Recompile 'translations.properties'
then the following is loggedand there is no hotswap event received.
After that, no hotswap events are sent any more when updating from outside IntelliJ either, i.e. HotswapAgent no longer reacts to
in any way
The text was updated successfully, but these errors were encountered: