SonarQube 6.7.5 startup failure: Failed to connect to the Wrapper at port 0


(Shiv) #1

I’m trying to start Sonar server via command line. Y:\sonarqube-6.7.5\bin\windows-x86-64\StartSonar.bat
As soon as I start I see error ‘server socket creation failed. (An invalid argument was supplied)’

JVM is starting fine but seems it’s unable to connect to wrapper

My java verison is

C:\Users\Shiv.Dewangan>java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

in wrapper.conf I’ve changed

wrapper.java.command=java 
to
wrapper.java.command=D:/apps/Java/jre1.8.0_112_x64/bin/java

Here’s the full debug log

--> Wrapper Started as Console
Using tick timer.
server socket creation failed. (An invalid argument was supplied. (0x2726))
server socket creation failed. (An invalid argument was supplied. (0x2726))
Launching a JVM...
command: "D:\apps\Java\jre1.8.0_112_x64\bin\java" -Dsonar.wrapped=true -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Xms8m -Xmx32m -Djava.library.path="./lib" -classpath "../../lib/jsw/wrapper-3.2.3.jar;../../lib/common/commons-codec-1.8.jar;../../lib/common/commons-io-2.4.jar;../../lib/common/commons-lang-2.6.jar;../../lib/common/commons-logging-1.1.3.jar;../../lib/common/elasticsearch-5.6.3.jar;../../lib/common/elasticsearch-rest-client-5.6.3.jar;../../lib/common/guava-18.0.jar;../../lib/common/hazelcast-3.8.6.jar;../../lib/common/hazelcast-client-3.8.6.jar;../../lib/common/HdrHistogram-2.1.9.jar;../../lib/common/hppc-0.7.1.jar;../../lib/common/httpasyncclient-4.1.2.jar;../../lib/common/httpclient-4.5.2.jar;../../lib/common/httpcore-4.4.5.jar;../../lib/common/httpcore-nio-4.4.5.jar;../../lib/common/jackson-core-2.9.5.jar;../../lib/common/jackson-dataformat-cbor-2.8.6.jar;../../lib/common/jackson-dataformat-smile-2.8.6.jar;../../lib/common/jackson-dataformat-yaml-2.8.6.jar;../../lib/common/jna-4.4.0-1.jar;../../lib/common/joda-time-2.9.5.jar;../../lib/common/jopt-simple-5.0.2.jar;../../lib/common/jul-to-slf4j-1.7.25.jar;../../lib/common/log4j-api-2.8.2.jar;../../lib/common/log4j-core-2.8.2.jar;../../lib/common/log4j-to-slf4j-2.8.2.jar;../../lib/common/logback-classic-1.2.3.jar;../../lib/common/logback-core-1.2.3.jar;../../lib/common/lucene-analyzers-common-6.6.1.jar;../../lib/common/lucene-backward-codecs-6.6.1.jar;../../lib/common/lucene-core-6.6.1.jar;../../lib/common/lucene-grouping-6.6.1.jar;../../lib/common/lucene-highlighter-6.6.1.jar;../../lib/common/lucene-join-6.6.1.jar;../../lib/common/lucene-memory-6.6.1.jar;../../lib/common/lucene-misc-6.6.1.jar;../../lib/common/lucene-queries-6.6.1.jar;../../lib/common/lucene-queryparser-6.6.1.jar;../../lib/common/lucene-sandbox-6.6.1.jar;../../lib/common/lucene-spatial-6.6.1.jar;../../lib/common/lucene-spatial-extras-6.6.1.jar;../../lib/common/lucene-spatial3d-6.6.1.jar;../../lib/common/lucene-suggest-6.6.1.jar;../../lib/common/netty-buffer-4.1.13.Final.jar;../../lib/common/netty-codec-4.1.13.Final.jar;../../lib/common/netty-codec-http-4.1.13.Final.jar;../../lib/common/netty-common-4.1.13.Final.jar;../../lib/common/netty-handler-4.1.13.Final.jar;../../lib/common/netty-resolver-4.1.13.Final.jar;../../lib/common/netty-transport-4.1.13.Final.jar;../../lib/common/parent-join-client-5.6.3.jar;../../lib/common/percolator-client-5.6.3.jar;../../lib/common/reindex-client-5.6.3.jar;../../lib/common/securesm-1.1.jar;../../lib/common/slf4j-api-1.7.25.jar;../../lib/common/snakeyaml-1.15.jar;../../lib/common/sonar-main-6.7.5.jar;../../lib/common/sonar-process-6.7.5.jar;../../lib/common/t-digest-3.0.jar;../../lib/common/transport-5.6.3.jar;../../lib/common/transport-netty4-client-5.6.3.jar;../../lib/sonar-application-6.7.5.jar" -Dwrapper.key="3vFWJRiR3ITHrjH8" -Dwrapper.port=0 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=6268 -Dwrapper.version="3.2.3" -Dwrapper.native_library="wrapper" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.sonar.application.App
JVM started (PID=6404)
server socket creation failed. (An invalid argument was supplied. 
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

Wrapper Manager: JVM #1
Running a 64-bit JVM.
Wrapper Manager: Registering shutdown hook
Wrapper Manager: Using wrapper
Load native library.  One or more attempts may fail if platform specific libraries do not exist.
Loading native library failed: wrapper-windows-x86-64.dll  Cause: java.lang.UnsatisfiedLinkError: no wrapper-windows-x86-64 in java.library.path
Loaded native library: wrapper.dll
Calling native initialization method.
Initializing WrapperManager native library.
Java Executable: D:\apps\Java\jre1.8.0_112_x64\bin\java.exe
Windows version: 6.1.7601
Java Version   : 1.8.0_112-b15 Java HotSpot(TM) 64-Bit Server VM
Java VM Vendor : Oracle Corporation

Control event monitor thread started.
Startup runner thread started.
WrapperManager.start(org.tanukisoftware.wrapper.WrapperSimpleApp@31cefde0, args[]) called by thread: main
Communications runner thread started.
Open socket to wrapper...Wrapper-Connection
Failed to connect to the Wrapper at port 0.
java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
Exiting JVM...
WrapperManager.stopImmediate(1) called by thread: Wrapper-Connection
server socket creation failed. (An invalid argument was supplied. (0x2726))
server socket creation failed. (An invalid argument was supplied. (0x2726))
server socket creation failed. (An invalid argument was supplied. (0x2726))
CTRL-C trapped.  Shutting down.

I did little google and added -Djava.net.preferIPv4Stack=true into wrapper.conf but it’s same error.

Any clue please ?


(G Ann Campbell) #2

Hi,

I’m guessing that’s from sonar.log? Could you take a look at the Troubleshooting guide, and give us any errors from the other logs?

SonarQube needs several different ports, and from what you’ve supplied so far, it looks like at least one of them isn’t available. The other logs should help identify which one in particular is the problem so that you can adjust the configuration in $SONARQUBE_HOME/conf/sonar.properties to use a port that is available.

 
Ann


(Shiv) #3

Hi Ann,

sonar.log is the only log available. since wrapper is not getting started, jvm seems not able to connect to it and being stopped so it’s not reaching to the point where web/ce/es servers can start.

Failed to connect to the Wrapper at port 0.
java.net.ConnectException: connect: Address is invalid on local machine, or port is not valid on remote machine
Exiting JVM...

I’ve no changes in sonar.properties files except changed the sonar.log.level to DEBUG mode.


(G Ann Campbell) #4

Okay, then I’m going to guess that it’s port 9000 that’s not available. Do you have something already running on that port? (Maybe a previously-started instance of SonarQube, or a zombie process from a previous attempt?)

 
Ann


(Shiv) #5

unfortunately no :cry:
I already checked (netstat -ano) ,9000 is not occupied by any process.

Y:\sonarqube-6.7.5\bin\windows-x86-64>tasklist /fi "pid eq 9000"
INFO: No tasks are running which match the specified criteria.

As soon as I start StartSonar.bat I see these 2 lines

server socket creation failed. (An invalid argument was supplied. (0x2726))
server socket creation failed. (An invalid argument was supplied. (0x2726))

google doesn’t help much , still so clueless.


(G Ann Campbell) #6

Well, how about updating $SONARQUBE_HOME/conf/sonar.properties to use a port other than 9000 that’s available on your machine?


(Nicolas Bontoux) #7

Hi,

After you check @ganncamp recommendations, if needed: which OS is this running on ? The error really seems to come from the Java/OS layer, I’m almost tempted to ask if you could try the same workflow an another machine and check if you get the same error.


(Shiv) #8

Hi Ann/Nicolas,

Find out that the Drive Y from where I was trying to start the sonarQube is DFS Share area and not my local machine drive. Probably that’s why It was not able to grab any port on my local machine (Not sure if it’s supposed to be or not, I’ll check with my network management team later).

Similar things I had noticed that when my Codes/Libraries are in some network drive, sonar-scanner unable to read them even though I can reach them via explorer or command-prompt. I used to getjava.lang.IllegalStateException: Unable to load component class error.


I’ve copied the sonarQube folder & codes to my local D drive and able to start the server and run the scanner.

Thanks for your time & help.


(Nicolas Bontoux) #9

Good stuff @shivdewangan, thanks for the update. I can confirm that using remote-mounted drives is clearly not recommended (there’s a quick mention on that in Hardware Recommendations).