Bug 1256062

Summary: Prosody service starts when network is not yet ready
Product: [Fedora] Fedora Reporter: Michael Wermeester <michael.wermeester>
Component: prosodyAssignee: Robert Scheck <redhat-bugzilla>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 22CC: jkaluza, michael.wermeester, mwild1, redhat-bugzilla, s.gendre
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 0.9.8-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-01 03:36:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
prosody.service none

Description Michael Wermeester 2015-08-23 17:35:02 UTC
Description of problem:
When the Prosody service is set to autostart, the service starts before the network interfaces are up/ready. This results in outgoing Prosody network connections to fail. 

Version-Release number of selected component (if applicable):
Arch        : x86_64
Epoch       : 0
Version     : 0.9.8
Release     : 4.fc22

How reproducible:
Often or always. (Always in my case, tested on different servers and setups)

Steps to Reproduce:
- Install prosody (dnf install prosody)
- Add a virtual host in /etc/prosody/conf.d
- Set prosody to autostart: systemctl enable prosody
- reboot the system: shutdown -r now

Actual results:
Warning appearing in /var/log/prosody/prosody.log:

>> Aug 23 16:40:13 mod_s2s	warn	No local IPv4 or IPv6 addresses detected, outgoing connections may fail

Indeed, outgoing s2s connections are not working. 

Expected results:

Outgoing s2s connections should work as expected and the warning should not appear in the /var/log/prosody/prosody.log file. 

Additional info:

The problem does not occur when starting prosody manually via "systemctl start prosody.service" when the network interfaces are up. 

One possible way to fix this problem is to change "After=network.target" to "After=network-online.target" in the the file /usr/lib/systemd/system/prosody.service.

With this change, Prosody starts up fine (without the warning) and s2s connections work as expected.

Comment 1 Michael Wermeester 2015-08-23 17:41:29 UTC
Created attachment 1066066 [details]
prosody.service

Changed

After=network.target

to

After=network-online.target

Comment 2 Robert Scheck 2015-08-23 19:13:19 UTC
Thank you for your report and the analysis. I contacted upstream for an
opinion regarding this while I consider your suggestion as the way to go.

Comment 3 Matthew Wild (MattJ) 2015-08-28 13:07:47 UTC
Upstream here.

Haven't seen this before, though it makes sense that it would happen if Prosody is started before networking is up.

Based on this, there are a couple of changes we are considering:

  - Delaying this check until the first outgoing s2s connection is attempted

  - Re-scanning local interfaces on SIGHUP

However regardless of these potential changes, I don't think it makes any sense to start a network service daemon when there is no network available. As systemd supports this, I think it's entirely sensible to make the proposed change to prosody.service.

Comment 4 Fedora Update System 2015-08-28 13:30:59 UTC
prosody-0.9.8-5.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-14492

Comment 5 Fedora Update System 2015-08-28 13:31:54 UTC
prosody-0.9.8-5.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-14493

Comment 6 Fedora Update System 2015-08-28 13:32:53 UTC
prosody-0.9.8-5.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-14494

Comment 7 Fedora Update System 2015-08-28 13:35:42 UTC
prosody-0.9.8-5.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-7835

Comment 8 Fedora Update System 2015-08-28 18:53:00 UTC
prosody-0.9.8-5.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update prosody'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-14494

Comment 9 Fedora Update System 2015-08-28 18:57:26 UTC
prosody-0.9.8-5.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update prosody'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-14493

Comment 10 Fedora Update System 2015-08-30 17:47:44 UTC
prosody-0.9.8-5.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update prosody'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2015-7835

Comment 11 Fedora Update System 2015-08-31 18:52:20 UTC
prosody-0.9.8-5.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.\nIf you want to test the update, you can install it with \n su -c 'yum --enablerepo=updates-testing update prosody'. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-14492

Comment 12 Fedora Update System 2015-09-01 03:36:01 UTC
prosody-0.9.8-5.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2015-09-06 04:49:50 UTC
prosody-0.9.8-5.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2015-09-06 06:20:22 UTC
prosody-0.9.8-5.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2015-09-19 17:23:15 UTC
prosody-0.9.8-5.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Sébastien Gendre 2017-02-25 15:48:28 UTC
I have the same problem.
With After=network-online.target in usr/lib/systemd/system/prosody.service.

Comment 17 Robert Scheck 2017-02-25 16:22:18 UTC
Sébastien, which version of Prosody do you use exactly? And what does
"rpm -q prosody" say?

Comment 18 Sébastien Gendre 2017-02-25 16:25:23 UTC
$ rpm -q prosody
prosody-0.9.12-1.fc25.x86_64

Comment 19 Robert Scheck 2017-02-25 16:43:33 UTC
"systemctl cat prosody.service" should contain "After=network-online.target",
which was the scope of this bug report.

Comment 20 Sébastien Gendre 2017-02-25 16:45:08 UTC
$ systemctl cat prosody.service 
# /usr/lib/systemd/system/prosody.service
[Unit]
Description=Prosody XMPP (Jabber) server
After=network-online.target

[Service]
Type=forking
PIDFile=/run/prosody/prosody.pid
ExecStart=/usr/bin/prosodyctl start
ExecReload=/usr/bin/prosodyctl reload
ExecStop=/usr/bin/prosodyctl stop

[Install]
WantedBy=multi-user.target

Comment 21 Robert Scheck 2017-02-25 21:29:07 UTC
So "After=network-online.target" exists, which is a point where the network
should be working. Can you describe your network setup? Currently, I am more
tempted to say that this is likely to be a network misconfiguration.

Comment 22 Sébastien Gendre 2017-02-26 19:29:53 UTC
# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0 
HWADDR=
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp2s0
UUID=
ONBOOT=yes
IPADDR=192.168.1.
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.1
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no

Comment 23 Sébastien Gendre 2017-03-05 03:23:02 UTC
(In reply to Robert Scheck from comment #21)

Any idea?