Java Socket Exception when connecting to SonarQube instance

Please provide

  • Operating system: Mac OS Sonoma 14.4.1
  • SonarLint plugin version: v4.6.0
  • Programming language you’re coding in: python, typescript, javascript
  • Is connected mode used: Attempting to Use Connected Mode
    • Connected to SonarCloud or SonarQube (and which version): SonarQube community 10.2.1 build 78527

And a thorough description of the problem / question:

When attempting to make a sonarqube connection in a multi-root workspace the extension throws an Exception: java.util.concurrent.CompletionException: java.net.SocketException: Bad file descriptor

Stack Trace

[Error - 15:03:25.093] java.util.concurrent.CompletionException: java.net.SocketException: Bad file descriptor
	at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)
	at java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processResponse(ServerApiHelper.java:110)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:95)
	at org.sonarsource.sonarlint.core.serverapi.component.ComponentApi.lambda$fetchComponent$9(ComponentApi.java:98)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:243)
	at org.sonarsource.sonarlint.core.serverapi.component.ComponentApi.fetchComponent(ComponentApi.java:97)
	at org.sonarsource.sonarlint.core.serverapi.component.ComponentApi.fetchComponent(ComponentApi.java:86)
	at org.sonarsource.sonarlint.core.serverapi.component.ComponentApi.getProject(ComponentApi.java:62)
	at org.sonarsource.sonarlint.core.ConnectionService.lambda$getProjectNamesByKey$8(ConnectionService.java:203)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.sonarsource.sonarlint.core.ConnectionService.getProjectNamesByKey(ConnectionService.java:202)
	at org.sonarsource.sonarlint.core.rpc.impl.ConnectionRpcServiceDelegate.lambda$getProjectNamesByKey$10(ConnectionRpcServiceDelegate.java:112)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.net.SocketException: Bad file descriptor
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
	at org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	... 1 common frames omitted```

Hello @jessedorsey!
Welcome to the Sonar Community!

How often do you get this error?

To investigate the issue better, could you please enable verbose logging and provide us with these logs?

Thanks

Hello Serhat!

I get this error whenever I try to generate the token. I also get the message

“Please ensure that your Server URL matches your SonarQube instance.”

My system status page returns

{"id":"243B8A4D-AYrSsTm-AfsFvO49mbkr","version":"10.2.1.78527","status":"UP"}

[Trace - 5:21:36 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 17:21:36.380] Request failed"
}


[Debug - 17:21:36.380] Request failed
[Trace - 5:21:36 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 17:21:36.381] java.net.SocketException: Bad file descriptor\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method)\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)\n\tat java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)\n\tat org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)\n\tat org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)\n\tat org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)\n\tat org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\n"
}


[Debug - 17:21:36.381] java.net.SocketException: Bad file descriptor
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
	at org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Error - 17:21:36.382] Internal error: java.net.SocketException: Bad file descriptor
[Trace - 5:21:36 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Error - 17:21:36.382] java.util.concurrent.CompletionException: java.net.SocketException: Bad file descriptor\n\tat java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)\n\tat java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processResponse(ServerApiHelper.java:110)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:95)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.get(ServerApiHelper.java:72)\n\tat org.sonarsource.sonarlint.core.serverapi.system.SystemApi.lambda$getStatus$0(SystemApi.java:38)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:243)\n\tat org.sonarsource.sonarlint.core.serverapi.system.SystemApi.getStatus(SystemApi.java:37)\n\tat org.sonarsource.sonarlint.core.TokenGeneratorHelper.doesServerSupportAutomaticUserTokenGeneration(TokenGeneratorHelper.java:86)\n\tat org.sonarsource.sonarlint.core.TokenGeneratorHelper.helpGenerateUserToken(TokenGeneratorHelper.java:63)\n\tat org.sonarsource.sonarlint.core.ConnectionService.helpGenerateUserToken(ConnectionService.java:188)\n\tat org.sonarsource.sonarlint.core.rpc.impl.ConnectionRpcServiceDelegate.lambda$helpGenerateUserToken$2(ConnectionRpcServiceDelegate.java:66)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\nCaused by: java.net.SocketException: Bad file descriptor\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method)\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)\n\tat java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)\n\tat org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)\n\tat org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)\n\tat org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)\n\tat org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)\n\t... 1 common frames omitted\n"
}


[Error - 17:21:36.382] java.util.concurrent.CompletionException: java.net.SocketException: Bad file descriptor
	at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)
	at java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processResponse(ServerApiHelper.java:110)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:95)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.get(ServerApiHelper.java:72)
	at org.sonarsource.sonarlint.core.serverapi.system.SystemApi.lambda$getStatus$0(SystemApi.java:38)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:243)
	at org.sonarsource.sonarlint.core.serverapi.system.SystemApi.getStatus(SystemApi.java:37)
	at org.sonarsource.sonarlint.core.TokenGeneratorHelper.doesServerSupportAutomaticUserTokenGeneration(TokenGeneratorHelper.java:86)
	at org.sonarsource.sonarlint.core.TokenGeneratorHelper.helpGenerateUserToken(TokenGeneratorHelper.java:63)
	at org.sonarsource.sonarlint.core.ConnectionService.helpGenerateUserToken(ConnectionService.java:188)
	at org.sonarsource.sonarlint.core.rpc.impl.ConnectionRpcServiceDelegate.lambda$helpGenerateUserToken$2(ConnectionRpcServiceDelegate.java:66)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)
	at org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.net.SocketException: Bad file descriptor
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
	at org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	... 1 common frames omitted

[Trace - 5:21:36 PM] Received response 'sonarlint/generateToken - (7028)' in 15ms. Request failed: Internal error. (-32603).
Error data: "java.util.concurrent.CompletionException: java.net.SocketException: Bad file descriptor\n\tat java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)\n\tat java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processResponse(ServerApiHelper.java:110)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:95)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.get(ServerApiHelper.java:72)\n\tat org.sonarsource.sonarlint.core.serverapi.system.SystemApi.lambda$getStatus$0(SystemApi.java:38)\n\tat org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:243)\n\tat org.sonarsource.sonarlint.core.serverapi.system.SystemApi.getStatus(SystemApi.java:37)\n\tat org.sonarsource.sonarlint.core.TokenGeneratorHelper.doesServerSupportAutomaticUserTokenGeneration(TokenGeneratorHelper.java:86)\n\tat org.sonarsource.sonarlint.core.TokenGeneratorHelper.helpGenerateUserToken(TokenGeneratorHelper.java:63)\n\tat org.sonarsource.sonarlint.core.ConnectionService.helpGenerateUserToken(ConnectionService.java:188)\n\tat org.sonarsource.sonarlint.core.rpc.impl.ConnectionRpcServiceDelegate.lambda$helpGenerateUserToken$2(ConnectionRpcServiceDelegate.java:66)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$0(AbstractRpcServiceDelegate.java:67)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.computeWithLogger(AbstractRpcServiceDelegate.java:135)\n\tat org.sonarsource.sonarlint.core.rpc.impl.AbstractRpcServiceDelegate.lambda$requestAsync$1(AbstractRpcServiceDelegate.java:65)\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\nCaused by: java.net.SocketException: Bad file descriptor\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method)\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)\n\tat java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)\n\tat org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)\n\tat org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)\n\tat org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)\n\tat org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)\n\tat org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)\n\t... 1 more\n"

Also a bunch of “pinging the bridge server” messages.

The server itself is running with a whitelist could that be causing this problem?