Very slow refreshes in IDEA

I’m refreshing my project in IDEA a lot today, and it seems to take 10-20 minutes each time.

But I started investigating what’s going on, and IDEA is just waiting for Gradle to finish.

When I start to profile Gradle, I see it handling a lot of exceptions, and calling slow Commons Lang code to walk the exception hierarchy.

org.apache.commons.lang.exception.ExceptionUtils.getCauseUsingMethodName() 2.5373385 362,566 ms (2.5%) 362,566 ms 362,571 ms 362,571 ms
org.apache.commons.lang.exception.ExceptionUtils.getCauseUsingFieldName() 0.15319394 22,012 ms (0.2%) 22,012 ms 22,012 ms 22,012 ms

These methods use reflection to do their job, and the sole purposes seems to be to support the old days of Throwable, when getCause() didn’t exist. Now getCause() does exist, so I don’t think you can just call getCause(), which should be much faster than this.

Is this worth filing as an issue in itself?

When I went to investigate the specific exception which was occurring, it turned out to be ModuleVersionResolveException. It is occurring on many dependencies, so I can’t pin down a specific cause. I don’t see anything in the log, and the operation just completes successfully after 10-20 minutes has passed, so I’m left worrying that Gradle is using exceptions as flow control, with no means of debugging it to figure out why. :frowning:

This is a bug in IDEA that should be fixed in the latest version. They were implementing some internal interface which caused lots of (recoverable) errors.

I’m also going to replace our usage of the commons-lang method, because we don’t need the backwards compatibility it provides and care more about speed.

Well, this worked out better than expected. I went on leave, and then when I got back, not only had the issue already been fixed, but the release came out, so it was like it took no time at all for them to fix it. :slight_smile:

I can confirm that the 2018.2.3 release doesn’t exhibit the issue, but remain slightly worried about code catching Error.