java IntelliJ 在调试前冻结约 30 秒

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30625785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 17:24:06  来源:igfitidea点击:

IntelliJ freezes for about 30 seconds before debugging

javadebuggingintellij-idea

提问by Thomas

when i try to debug my java app the IDE freezes for about 30 seconds with the message: "Finished, saving caches"

当我尝试调试我的 Java 应用程序时,IDE 冻结了大约 30 秒并显示以下消息:“已完成,正在保存缓存”

After it unfreezes all works fine. It happens every time.

解冻后一切正常。它每次都会发生。

When i only run (not debug) it does not freeze.

当我只运行(而不是调试)时,它不会冻结。

What i tried:

我试过的:

  • I changed the JDK on system.
  • I changed the IntelliJ version.
  • I change to IntelliJ Ultimate - trial.
  • Invalidating the IDE's cache.
  • Similar problem
  • I also figured out that the given message exists only it this area of code - github-projectso i changed the JVM options to give InteliJ more ram.
  • 我更改了系统上的 JDK。
  • 我更改了 IntelliJ 版本。
  • 我改用 IntelliJ Ultimate - 试用版。
  • 使 IDE 的缓存无效。
  • 类似问题
  • 我还发现给定的消息只存在于这个代码区域 - github-project所以我改变了 JVM 选项来给 InteliJ 更多的内存。

InteliJ build IC-141.1010.3.

InteliJ 构建 IC-141.1010.3。

When i try to debug in other IDE's it works fine, only InteliJ gets stuck...

当我尝试在其他 IDE 中调试时,它工作正常,只有 InteliJ 卡住了...

I submitted a ticket to jetbrains too, but i know the power of StackOverflow :)

我也向 jetbrains 提交了一张票,但我知道 StackOverflow 的力量:)

I have a MacBookPro 2015 and JDK 1.8

我有 MacBookPro 2015 和 JDK 1.8

回答by Shawn Lu

If anyone else is still having this problem, I found this related issue on the IntelliJ board: https://youtrack.jetbrains.com/issue/IDEA-157303

如果其他人仍然有这个问题,我在 IntelliJ 板上发现了这个相关的问题:https: //youtrack.jetbrains.com/issue/IDEA-157303

It seems the problem is related to resolving hostnames. The recommended workaround is to include the following line in your /etc/hostsfile:

问题似乎与解析主机名有关。建议的解决方法是在您的/etc/hosts文件中包含以下行:

127.0.0.1       localhost     <your hostname goes here>.local

And for IPv6 resolving, the same:

对于 IPv6 解析,相同:

::1             localhost     <your hostname goes here>.local

回答by danhnn.uit

Well, the issue took me around 3 hours to find out how to overcome it. For anyone has tried "modifying etc host file" solution from Jayson Minard and still not worked. Just go to SystemPreference -> Sharing and turn on File Sharing. That's on and it will let you debug your Java app on IntelijIdea 2017 very very very fast !!!!!!

好吧,这个问题花了我大约 3 个小时才找到解决方法。对于任何人都尝试过 Jayson Minard 的“修改等主机文件”解决方案,但仍然没有奏效。只需转到 SystemPreference -> 共享并打开文件共享。这样就可以了,它可以让您在 IntelijIdea 2017 上非常非常非常快地调试 Java 应用程序!!!!!!

enter image description here

在此处输入图片说明

回答by Thomas

The support from IntelliJ told me to try the IDE with bundled java.

IntelliJ 的支持告诉我尝试使用捆绑的 Java 的 IDE。

http://download.jetbrains.com/idea/ideaIC-14.1.3-custom-jdk-bundled.dmg

http://download.jetbrains.com/idea/ideaIC-14.1.3-custom-jdk-bundled.dmg

And it works!

它有效!

Edit:

编辑:

IntelliJ support feedback: The problem was that there was a hang within java.net.Inet4AddressImpl.getLocalHostName(Native Method)JDK method call, which gets your system hostname. This is either JDK problem or local configuration issue...

IntelliJ 支持反馈:问题在于java.net.Inet4AddressImpl.getLocalHostName(Native Method)JDK 方法调用中出现挂起,它获取您的系统主机名。这是JDK问题还是本地配置问题...

The solution for this is here.

解决方案在这里