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!

2
11 comments

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.

0

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.

2

same problem 

i found KB4074588  would change hyper-v port reverse range

 

 

To resolve this issue, use the following workaround.

Check if the port you want to bind to or reserve is already reserved on the container host. For example, you can use netsh as follows:

netsh interface ipv4 show excludedportrange protocol=tcp


If the port is not reserved, you may use it. If it is reserved, choose a different port.

 



λ netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port End Port
---------- --------
1080 1080 *
1720 1819
1820 1919
1920 2019
2020 2119
2120 2219
2220 2319
2320 2419
2420 2519
2638 2737
2738 2837
2838 2937
2938 3037
3038 3137
3138 3237
3390 3489
3490 3589
3830 3929
3930 4029
4030 4129
4130 4229
4230 4329
4330 4429
4430 4529
4530 4629
4933 5032
5041 5140
5141 5240
5357 5357
5358 5457
5556 5655
5656 5755
5801 5900
6001 6100
6550 6649
6650 6749
6750 6849
6850 6949
6950 7049
7050 7149
7150 7249
7250 7349
7881 7980
7981 8080
8081 8180
8181 8280
8281 8380
8381 8480
8481 8580
8581 8680
8795 8894
8895 8994
8995 9094
9095 9194
9195 9294
9295 9394
50000 50059 *

* - Administered port exclusions
0

i removed hypervisior of my windows . reboot , boom ... it works

 

0
Avatar
Permanently deleted user
0

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?

0

Is there any documentation link that would confirm that all these 50 ports are reserved for Hyper-V?

0

Here's what I've found (link-heavy - sorry in advance):

  • By default Windows Vista onward reserves ports 49152 to 65535 as dynamic ports (here)
  • It seems that updating to the insider preview to get access to WSL2, or maybe at some other time during the insane number of upgrades/cumulative updates/patches, the dynamic port range got reset to 1024-64511 (image below)
  • Hyper-V, it appears as if it's part of the Hyper-V Replica service is supposed to reserve ports in this original dynamic range (here)
  • Due to the screw-up with Windows, and I'm assuming Hyper-V just randomly taking from the complete dynamic range instead of just the upper range of port

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.

netsh int ipv4 set dynamicport tcp start=49152 num=16383
netsh int ipv4 set dynamicport udp start=49152 num=16383

 

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).

4

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!

  • Wi-Fi
  • Ethernet
  • Bluetooth Network Connection
  • Private Internet Access VPN virtual adapter
  • Npcap Loopback Adapter for Wireshark
  • vEthernet (Default Switch) for Hyper-V
  • vEthernet (Ethernet 3) for another Hyper-V switch
  • vEthernet (Ethernet) for another Hyper-V switch
  • vEthernet (Npcap Loopback) for some kinda weird Hyper-V thing on top of the Wireshark adapter I dunno
  • vEthernet (Wi-Fi) also for Hyper-V I guess
  • vEthernet (WSL) seemed to show up when I updated to Windows 10 2004

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.

Get-NetAdapter | Disable-NetAdapter -Confirm:$false -PassThru:$true | Enable-NetAdapter
4

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 .

0
Avatar
Permanently deleted user

@Phillip Stromberg Your solution worked for me! After disabling and re-enabling all network adapters PyCharm would start.

1

Please sign in to leave a comment.