file refresh and coffee breaks
Since upgrading to IDEA 2018.3, I frequently find myself being encouraged to take a coffee break because a file refresh operation suspends code analysis. Instant code analysis is the main reason to use IDEA instead of a text editor; it is too easy to make mistakes without it. I do not recall noticing this problem in earlier releases.
File refresh often happens when I resume working in IDEA (after using other applications), which is the worst possible time. File refreshes have gotten faster in 2018.3.2 (vs 2018.3), but they are still annoying.
Even if there is a slight chance that the code analysis is based on stale data, it would be better to have it than to not have it.
I am not using a networked file system. I am using an external drive with APFS.
Please sign in to leave a comment.
>File refresh often happens when I resume working in IDEA (after using other applications),
Are there any external cnages on the files/directories inside the project or in the project configuration itself between the moment of last IDE usage and moment you bring the application focus back? Do you use custom plugins? Please provide IDE log folder zipped after issue happens. For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.
I am not aware of any external changes. For example, I just activated IDEA after being away from home for 5 hours and the first thing it did was a file refresh.
The only custom plugin I use is Auto-Format text.
I have uploaded the following, which I made immediately after the file refresh completed.
How much time did the refresh take? How do you connect external drive? Do you see same refreshes if use mac's native drive?
What is the project type? How many files do you have under the project directories? Are there any generated file (output of scripts, logs etc)?
Does it make a difference if (temporarily) remove fsnotifier binary from .../IntelliJ IDEA 2018.3 .app/Contents/bin folder and start IDE?
It is a Java project. I'm not sure how many files there are, but a complete build took about 3 minutes.
The most recent refresh also took about 3 minutes.
I had opensnoop running when this refresh was done, and it appears that IDEA scanned about 27000 directories, most of which was the full directory tree of a large project that was not open at the time (OpenJDK). There were also some directories from other OpenJDK repos that were scanned.
Based on a quick examination of the directories in my project, I see only one file that was read:
/Users/alan/P/hack/Valerie/out/production/Valerie/libvalerie.dylib.dSYM
I did not see any writes by any process into the scanned directories before that refresh.
The next three scans were short and targeted one directory:
/Users/alan/P/hack/Utils/src/com/cbfiddle/webgen
Not sure why. Nothing had been updated there since two days ago.
I'll try the fsnotifier idea.
Without fsnotifier, file refreshes when this project is open take about a minute and scan 2000-3000 directories.
>I had opensnoop running when this refresh was done, and it appears that IDEA scanned about 27000 directories, most of which was the full directory tree of a large project that was not open at the time (OpenJDK). There were also some directories from other OpenJDK repos that were scanned.
Are there any symlinks in the oproject that you open or any libraries that you are using can be related to the scanned directories that are outside of project?
There are no such symlinks.
What I noticed (running without fsnotifier) is that just after I closed an OpenJDK project, it scanned the OpenJDK project directory (which takes a long time).
Is it intentional that projects are refreshed after they are closed?
If so, why would code analysis be suspended on the projects that remain open?
Refresh is needed in cases like IDE configuration saves, refactorings other IDE actions (like application activation/deactivation). Code analysys needs the completed and commited state of the conponens and files. The issue may be caused by slow I/O disk operations. Have you tried testing it on macOS native drive?
As a workaround it could help to disable Synchronize files on frame activation under Preferences | Appearance & Behavior | System Settings | Synchronization section.
My native drive is an SSD, so I'm sure it would be much faster. I don't think that is a reasonable requirement, however.
I agree that code analysis needs committed data. The issue is whether the data is locked during the refresh, or the refresh is implemented as an atomic update to the data. The latter would be much better, especially when the stale data is irrelevant to the file being edited. In many of these cases, such as refreshing a closed project, the stale data is irrelevant.
I will try your workaround. Thank you for suggesting it.
There is a related request: https://youtrack.jetbrains.com/issue/IDEA-130373
To try better to understand at which point the file refresh happens you could try first to restart the IDE and then consistently switch to other applications and back and monitor after which actions such a long refresh happens.
You could also enable more verbose logging by adding
into Help | Debug Log Settings... dialog.