windowsintellij-ideawindows-firewall

Cannot establish network connection from WSL to Windows host (could be blocked by firewall)


Every time I restart my laptop and intellij idea IDE, I get following error:
This happen when idea trying to index.

Abnormal build process termination: 
C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/bash -l -c "cd ....
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.openapi.diagnostic.JulLogger (file:/root/.cache/JetBrains/IntelliJIdea2023.2/compile-server/jps-IU-232.10203.10/util-8.jar) to field java.lang.ApplicationShutdownHooks.hooks
WARNING: Please consider reporting this to the maintainers of com.intellij.openapi.diagnostic.JulLogger
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Build process started. Classpath: /root/.cache/JetBrains/IntelliJIdea2023.2/compile-server/jps-IU-232.10203.10/jps-launcher.jar
Error connecting to 172.....:61....; reason: connection timed out: /172......1:61...
io.netty.channel.ConnectTimeoutException: connection timed out: /172....:61....
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:261)
    at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
    at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:829)
Exiting.
Cannot establish network connection from WSL to Windows host (could be blocked by firewall). More details: https://jb.gg/wsl-firewall

As a workaround I did the step as per the instruction in https://jb.gg/wsl-firewall and It works. Bur I have to do it each and every time I restart the machine. I need to know, can we disable firewall rules for intellij idea IDE and WSL processes permanently?


Solution

  • This is a known issue in Microsoft WSL, it's still not fixed, please check https://github.com/microsoft/WSL/issues/4139#issuecomment-1200345491 as a workaround.