Gerrit fails to start on MAC when setting httpd.listenUrl and sshd.listenAddress to an IP address

166 views
Skip to first unread message

Khai Do

unread,
Feb 19, 2016, 2:04:38 PM2/19/16
to Repo and Gerrit Discussion
Hello.  The gerrit docs says that the configuration for sshd.listenAddress[1] and httpd.listenUrl[2] can be set to a specific IP address however when I do that I can't seem to get Gerrit to start.  Gerrit will start without error when those params are set to the default (*:29418 and http://*:8080).   Also I'm only seeing this issue on the MAC (El Capitan).  When I copy the entire Gerrit site to my Linux (ubuntu trusty) VM it starts up without error.  I'm wondering if I'm missing some other configuration or whether this a bug that only occurs on the MAC?   I can repro this with Gerrit 2.11.x and master and I have verified that I have no other instances of Gerrit running.



My gerrit.config:
---------------------
[gerrit]
    basePath = git
    canonicalWebUrl = http://127.1.47.7:8080/
[database]
    type = h2
    database = db/ReviewDB
[auth]
    type = DEVELOPMENT_BECOME_ANY_ACCOUNT
[sshd]
    listenAddress = 127.1.47.7:29418
[httpd]
    listenUrl = http://127.1.47.7:8080/
---------------------

The error:
--------------
[2016-02-19 10:18:15,737] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.IllegalStateException: Cannot bind to 127.1.47.7:29418
at com.google.gerrit.sshd.SshDaemon.start(SshDaemon.java:305)
at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:74)
at com.google.gerrit.pgm.Daemon.start(Daemon.java:289)
..

Caused by: java.io.IOException: Error while binding on 127.1.47.7/127.1.47.7:29418
original message : Can't assign requested address
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:238)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:51)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(Abstrac
..





Alex Blewitt

unread,
Feb 19, 2016, 2:13:48 PM2/19/16
to Khai Do, Repo and Gerrit Discussion
Firstly, Mac is an abbreviation for Macintosh and therefore shouldn't be capitalised. It’s not an acronym in this case.

Secondly, the error message suggests that it can’t bind to the address on 127.1.47.7 on port 29418. This is either because (a) that’s not the IP address of your Mac, (b) there’s something already running on 29418, or (c) your firewall rules are set up such that the application can’t create a service running on that address (but will instead be fine if a different address is chosen). Does it work if you run it on 127.0.0.1, which is typically the address of the loopback address? 

Alex

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Khai Do

unread,
Feb 19, 2016, 2:40:39 PM2/19/16
to Repo and Gerrit Discussion, zaro...@gmail.com
Thanks, will remember the mac thing going forward.  Yeah, so 127.0.0.1 will work but I'm wondering why Gerrit doesn't have a problem with '127.1.47.7' on my linux VM.  I've checked and the firewall is turned off on my mac.

Alex Blewitt

unread,
Feb 19, 2016, 3:11:34 PM2/19/16
to Khai Do, Repo and Gerrit Discussion
What investigation have you done? Where did the IP address come from? Have you tested whether or not you can eg ping it from a terminal? Or did you make up a bunch of numbers?

If I had to guess I would say that the loop back interface on Linux had a netmask of 255.0.0.0 which means it would respond to 127.x.x.x but on OSX it has a netmask of 255.255.255.255 which means it would only respond to 127.0.0.1. But you need to investigate more about your basic networking setup first. 

Alex

Sent from my iPhat 6

Khai Do

unread,
Feb 19, 2016, 6:52:03 PM2/19/16
to Repo and Gerrit Discussion, zaro...@gmail.com
This for the info.  I'm investigating the tests from git-review project (https://pypi.python.org/pypi/git-review) and why they don't work on Macs but seem to run just fine on linux.  The ip address is randomly auto generated from the test framework.   The tests are designed to run Gerrit with the system's loopback address.  It looks like this works on linux because most modern linux kernels have all of 127.*.*.* mapped to the loopback interface.  This however isn't the case on Macs.  OSX only maps a single address (127.0.0.1) to the loopback.  You can map additional addresses using the ifconfig alias command.  However since the tests create a random address ranging from 127.0.0.0 to 127.255.255.255 for each test it would require mapping the entire 127.*.*.* range to the loopback interface.  I've tried doing that with a script but that seemed to basically kill my network. Unfortunately I am not able to figure out a better way to do the mapping  :( 

-Khai
Reply all
Reply to author
Forward
0 new messages