Closed PavelSann closed 7 years ago
Repeat on other projects failed. Perhaps the configuration files were from the old version or damaged.
This is the shutdown hook trying to save the configurations.
If you look at that method in the sources, it does nothing fancy but reads the config file from the disk. So, it means that the file system does not answer for some reason (or is slow for something, maybe a slow network drive?).
Though I don't think I can fix this problem but I might mitigate it by being less aggressive when saving the configurations. I will see if there is anything I can do about that.
It is possible that something is keeping this file open for writing and the read waits for new writes. What OS are you using?
OS windows 7, x64 The problem was repeated all the time, but only on one of the projects. I think it was the file that was to blame. I'm sorry I did not save it for tests.
I seriously doubt that it is the content of the file, you may look at NbFileUtils.tryGetLineSeparatorForTextFile but it really just loops over a file stream, there is no compicated parsing here. If anything, then it was the location or that it was open for writting (with shared read).
Perhaps the method (tryGetLineSeparatorForTextFile) contains an eternal loop.
int readCount = input.read(buffer); while (readCount > 0) { ... input.read(buffer); }
14 июля 2017 г. 1:47 пользователь "Attila Kelemen" notifications@github.com написал:
This is the shutdown hook trying to save the configurations.
If you look at that method in the sources, it does nothing fancy but reads the config file from the disk. So, it means that the file system does not answer for some reason (or is slow for something, maybe a slow network drive?).
Though I don't think I can fix this problem but I might mitigate it by being less aggressive when saving the configurations. I will see if there is anything I can do about that.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kelemen/netbeans-gradle-project/issues/344#issuecomment-315197468, or mute the thread https://github.com/notifications/unsubscribe-auth/AK5M_yFXAdvTqk_wRbp0NNYjgyXGFZJ_ks5sNoJfgaJpZM4OWmNf .
That would mean, that Files.newInputStream(file)
(which is a core JDK method) returns an infinitely long file stream. Given that there are no infinitely long files, I doubt that, because that would be a huge bug in the JDK.
The readCount variable is set before the loop, it does not change in the body of the loop.
If more than 0 bytes are read from the file, the condition in "while (readCount> 0)" will always be true.
At the end of the cycle, "input.read (buffer)" is written. Probably it is necessary "readCount = input.read (buffer)"
16 июля 2017 г. 16:00 пользователь "Attila Kelemen" < notifications@github.com> написал:
That would mean, that Files.newInputStream(file) (which is a core JDK method) returns an infinitely long file stream. Given that there are no infinitely long files, I doubt that, because that would be a huge bug in the JDK.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kelemen/netbeans-gradle-project/issues/344#issuecomment-315601535, or mute the thread https://github.com/notifications/unsubscribe-auth/AK5M_xRUaKQsIrza9XdQVa7D64f-SPT1ks5sOe05gaJpZM4OWmNf .
Thanks, I didn't even notice that the second read fails to set the readCount
. I guess noone noticed this bug simply because the first line should always be shorter than 8 kB. This bug actually prevents saving settings until you close NB. I will fix it and will have a new release (fixing another bug).
I have released a new version containing the fix of this bug. You can wait for it to be available in the plugins menu or install it manually (for the NB Plugin Portal page or from the releases page of GitHub).
Netbeans hangs when it exits. In the tryGetLineSeparatorForTextFile method from the class java.org.netbeans.gradle.project.util.NbFileUtils.
It helps to delete files "gradle-app.setting" ".nb-gradle-properties" and folder ".nb-gradle"