Bind for 0.0.0.0:8828 failed: port is already allocated

Hi,
Installed a local server. Docker containers are up. Keys and certificate installed. Launcher bootstrap went OK. Launcher start went OK with default values of local.properties. Server is on the internet and ports forwarded. (fail2ban, No Passw Auth).
But after I modified local.properties with local server values I get ERROR on port 8828.
This is my local.properties:

# Kontalk server configuration
# if you edit this file you must rebuild your containers:
# ./launcher rebuild

INSTANCE_NAME=motorbende

# version/branch to build
VERSION=production

# XMPP parameters
XMPP_SERVICE=217.122.173.95
XMPP_LISTEN_PORT=5222
XMPPS_LISTEN_PORT=5223
XMPPS2S_LISTEN_PORT=5269

# Database parameters

# kontalk database user password
MYSQL_PASSWORD=kontalk
# root database user password
MYSQL_ROOT_PASSWORD=root
# database timezone
MYSQL_TIMEZONE=Europe/Amsterdam

# Other parameters

# Max upload file size
HTTPUPLOAD_MAX_SIZE=20971520

# HTTP listen port
HTTPUPLOAD_LISTEN_PORT=8828

# HTTP URLs
HTTPUPLOAD_PUT_URL=https://217.122.173.95/media
HTTPUPLOAD_GET_URL=https://217.122.173.95/media

And this is the startup error:

rene@motorbende:~/kontalk-server$ sudo ./launcher bootstrap
Building images for branch production (9114e45c9e1a7c4e3e06a4fc45f98f7657a4aaca)
This could take several minutes.
kontalk/xmppserver:9114e45 OK
kontalk/httpupload OK

Successfully bootstrapped, to startup use ./launcher start
rene@motorbende:~/kontalk-server$ sudo ./launcher start
+ /usr/bin/docker-compose -p motorbende up -d
Creating network "motorbende_default" with the default driver
Creating motorbende_httpupload
Creating motorbende_db
Creating motorbende_xmpp

ERROR: for httpupload  Cannot start service httpupload: driver failed programming external connectivity on endpoint motorbende_httpupload (b6aebca3f73756fe2a07dd8a2a7cdedf1a76f308a711d87c499d27e0701c8e2e): Bind for 0.0.0.0:8828 failed: port is already allocated

ERROR: for xmpp  Cannot start service xmpp: grpc: the connection is unavailable
ERROR: Encountered errors while bringing up the project.
rene@motorbende:~/kontalk-server$

This parameter should contain the XMPP service name (what will come after the “@” symbol in user IDs). Even if the domain doesn’t exist, it must be a domain or host name. You can always use the IP address in the manual server address in the app like this:

what_you_put_in_XMPP_SERVICE|217.122.173.95

About the busy port thing: are you sure there is nothing else listening on that port? Maybe some leftover of some old Docker container?

Daniele,
Thank you for the advice. Corrected the XMMP service name. You were right; an old container blocked the port! Stopped and removed all containers and restart (rebuild) went OK.
Have to study a bit more I’m afraid because registration didn’t work yet. I did enter the server address before registration. I get a verification error.
Any advise how I can test if the server is running well with respect to registration?

This is the debug log on the client:

2017-12-12 21:10:56 V/NumberValidation: Using phone number to register: +31***********
2017-12-12 21:10:57 D/NumberValidation: phone number checked, sending validation request
2017-12-12 21:10:57 D/MessageCenterService: using server 217.122.173.95

2017-12-12 21:11:27 E/NumberValidation: validation error.

2017-12-12 21:11:27 E/NumberValidation: org.jivesoftware.smack.SmackException$ConnectionException: The following addresses failed: '_xmpp-client._tcp.217.122.173.95:5222' failed because: de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp.217.122.173.95.	IN	SRV yielded an error response NX_DOMAIN, '217.122.173.95:5222' failed because: /217.122.173.95 exception: java.net.SocketTimeoutException: failed to connect to /217.122.173.95 (port 5222) from /192.168.12.206 (port 42026) after 30000ms
	at org.kontalk.client.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPConnection.java:618)
	at org.kontalk.client.XMPPTCPConnection.connectInternal(XMPPTCPConnection.java:890)
	at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.java:379)
	at org.kontalk.service.XMPPConnectionHelper.connectOnce(XMPPConnectionHelper.java:202)
	at org.kontalk.service.XMPPConnectionHelper.connectOnce(XMPPConnectionHelper.java:151)
	at org.kontalk.client.NumberValidator.initConnection(NumberValidator.java:672)
	at org.kontalk.client.NumberValidator.run(NumberValidator.java:307)
	at java.lang.Thread.run(Thread.java:764)


2017-12-12 21:11:27 W/NumberValidator: shutting down
2017-12-12 21:11:27 W/NumberValidator: exiting

Regards,
René

Moderator edit: Replaced part of the phone number with ***** for privacy reasons.

Read again :slight_smile: the format of the manual server address must be like this:

what_you_put_in_XMPP_SERVICE|217.122.173.95

Daniele,
Thank you, but 'm afraid that still don’t understand exactly.
The server didn’t have a domain name, so I corrected that.
I have now: XMPP_SERVICE=clubhouse.motorbende.net. (not existing)
In the Kontalk app, I enter the ip address 217.122.173.95 in the manual server address.
The log says, a personal key is generated. But still I get the ‘E/NumberValidation: validation error’ in the debug log. And registration fails.
After reading old posts, I think I understand the registration process. Added NexmoVerifyProvider (and my key+secret+Kontalk) as lined out in the local-server-howto.md#registration.
Still no registration!
I looked up some of the error messages in the debug log e.g. "de.measite.minidns.hla.ResolutionUnsuccessfulException: Asking for _xmpp-client._tcp"
From what I read it looks to me as if the XMPP service has no connection with my IP address. But unfortunately I have no expertise in this field.
Any suggestions?

Regards, René

Enter this in manual server address:

clubhouse.motorbende.net|217.122.173.95

Even if the hostname doesn’t exist, Kontalk will use the IP address to phisically connect and the hostname during the handshake because it’s required to know it when you handshake with a XMPP server, it doesn’t matter if it’s real or not.

bootstrap and start are without errors but ‘docker container ls’ indicates that xmppserver is restarting all the time.
rene@clubhouse:~/kontalk-server$ sudo docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
87e8b48f832c kontalk/xmppserver:9114e45 “/home/kontalk/ent
” 2 hours ago Restarting (1) 46 seconds ago clubhouse_xmpp
5b86f6349ec4 mysql:5.6 “docker-entrypoint
” 2 hours ago Up 2 hours 3306/tcp clubhouse_db
a9fb254cab4a kontalk/httpupload “/home/kontalk/ent
” 2 hours ago Up 2 hours 0.0.0.0:8828->8828/tcp clubhouse_httpupload

all problems solved; xmpp server was restarting due to permission on .pem file. modified this and works fine now. verification problem in the app was due to a typo; a space in ‘’ ‘clubhouse.motorbende.net|217.122.173.95’ after .net caused the problem.
Everything now works like a charm. (and I learned a lot about docker and xmpp :wink:
The instruction to set up the docker version of Kontalk is very good.
Regards René

2 Likes

I’m glad to hear that. If you think something needs improvement or fixing please let us know here or better submit a feature request in GitHub or (even better, if you have the time) a pull request to fix or enhance something.
Happy holidays!