Critical Internal Error on Startup of IntelliJ IDEA: "Cannot Lock System Folders"
Answered
Problem description
I have installed IntelliJ IDEA Ultimate 2019.2 on my computer running Windows 10 Insider Preview (Build 18963.1000).
However, every time I launch IntelliJ IDEA now, it cannot be successfully launched and will pop up a window showing an error message as follows:
The full error message is pasted below, which include the stacktrace and may help to locate the error:
Internal error. Please report to http://jb.gg/ide/critical-startup-errors
java.net.BindException: Address already in use: bind
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:461)
at java.base/sun.nio.ch.Net.bind(Net.java:453)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:132)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.lang.Thread.run(Thread.java:834)
-----
JRE 11.0.3+12-b304.10 amd64 by JetBrains s.r.o
C:\Users\<My username>\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\192.5728.98\jbr
Attempts to solve the problem
I have attempted to solve the problem by taking the following steps, but in vain:
- I attempted to reboot the computer and retry to launch IntelliJ IDEA. It did not work.
- According to some information on the Internet, I learned that it may have something to do with unavailable ports; however, I cannot find the information about which port is needed in the error message and therefore cannot solve the problem this way.
- I attempted to launch PyCharm Professional 2019.2 on the same computer, and it reported the exactly same error as IntelliJ IDEA.
I have not launched IntelliJ IDEA on this computer for several months, so I'm afraid that I cannot figure out which of the changes to my computer has caused the problem.
So is there something I can do to solve the problem? If yes, how can I do it?
Thanks in advance!
Please sign in to leave a comment.
I attempted to enter the security mode of Windows and in security mode IntelliJ IDEA and PyCharm can be successfully launched. As I reboot and return to the normal mode now, IntelliJ and PyCharm both work perfectly.
To lock folders IDE is starting a server on localhost, it tries to bind on the first available port between 6942 and 6991, this exception is thrown if IDE was not able to bind on any of the ports in this range. All 50 ports are unlikely to be already used on a machine, so it appears to be a networking issue or some security software which doesn't permit IDE to bind on any port in this range even on localhost interface.
You can check with TcpView if these ports are already taken: https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview . It will show the process using the ports.
But in case of the firewall it can just block the bind operation and TcpView will not show anything.
"netsh winsock reset" followed by the reboot usually helps.
same problem
i found KB4074588 would change hyper-v port reverse range
i removed hypervisior of my windows . reboot , boom ... it works
this solution also works: https://github.com/docker/for-win/issues/3171#issuecomment-459205576
It seems that these ports are getting reserved by Hyper-V, which is now used with WSL2. Would it be possible to bind to a random open/unreserved port instead of a set range of possible ports?
Is there any documentation link that would confirm that all these 50 ports are reserved for Hyper-V?
Here's what I've found (link-heavy - sorry in advance):
QUICK FIX:
Run the following commands to reset the dynamic port range to what it should be and reboot - this should fix things until Windows messes up the dynamic port range again. This is only for ipv4. I haven't looked at ipv6, but I'd assume it's similar.
In the end, I would still request that JetBrains try to connect over a random open port >1024 rather than a set range just in case something similar happens again (I know that BitTorrent likes to use those ports as well by default from my research on this).
You can also try disabling and re-enabling all your network adapters (you know, in case you don't want to reboot every time a JetBrains IDE throws a fit on startup for no reason because binding to a port on startup is an idiotic idea). Maybe Jetbrains should check what network adapter it's trying to bind to first. I suspect some virtual adapters just don't support binding at all. With Windows 10 2004 there's a new Windows Subsystem for Linux 2 (WSL) network adapter introduced and Docker seems to run on that now instead of Hyper-V. I've got 11 network adapters in ncpa.cpl on my laptop!
Anyway, here's a Powershell one-liner you can paste into an elevated Powershell window to disable and then re-enable all of your network interfaces and then everything magically works again.
It's Windows issue reserving too much common ports, see this ticket for more details and the proper workaround: https://youtrack.jetbrains.com/issue/IDEA-238995 .
@Phillip Stromberg Your solution worked for me! After disabling and re-enabling all network adapters PyCharm would start.