Bug 2099620

Summary: Starting or Restarting foreman.socket will raise a harmless "TCP_NODELAY failed: Operation not supported" error in Red Hat Satellite 6.9/6.10/6.11
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: InstallationAssignee: Evgeni Golov <egolov>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.6CC: egolov, gtalreja, pcreech, zhunting
Target Milestone: 6.12.0Keywords: Triaged, WorkAround
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:34:13 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:

Description Sayan Das 2022-06-21 10:56:31 UTC
Description of problem:

When we try to start the foreman.service, It triggers the startup of foreman.socket at the backend. 

During this startup, we get to see "TCP_NODELAY failed: Operation not supported" printed in the system logs which is harmless in nature but unexpected to see.



Version-Release number of selected component (if applicable):

Red Hat Satellite 6.9
Red Hat Satellite 6.10
Red Hat Satellite 6.11


How reproducible:

Always

Steps to Reproduce:

1. Install a Satellite 6.9\6.10\6.11

2. Try; 

  # for i in stop start; do systemctl $i foreman.socket; sleep 5; done

  or simply # systemctl restart foreman.socket
  
  or
  
  # foreman-maintain service stop
  # foreman-maintain service start

3. Monitor /var/log/messages or check the status of foreman.socket using systemctl


Actual results:

Jun 21 16:17:37 satellite.example.com systemd[1]: TCP_NODELAY failed: Operation not supported
Jun 21 16:17:37 satellite.example.com systemd[1]: Starting Foreman HTTP Server Accept Sockets.
Jun 21 16:17:37 satellite.example.com systemd[1]: Listening on Foreman HTTP Server Accept Sockets.


Expected results:

No "TCP_NODELAY failed: Operation not supported" message


Additional info:

The foreman.socket is actually a UNIX socket but it includes a TCP option in it i.e. "NoDelay=true" which is a TCP only option

# grep NoDelay /usr/share/foreman/extras/systemd/foreman.socket /usr/lib/systemd/system/foreman.socket
/usr/share/foreman/extras/systemd/foreman.socket:NoDelay=true
/usr/lib/systemd/system/foreman.socket:NoDelay=true

# man 7 tcp | grep TCP_NODELAY -A4 | tail -6
--
       TCP_NODELAY
              If  set,  disable  the  Nagle  algorithm.  This means that segments are always sent as soon as possible, even if there is only a small amount of data.
              When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets,  which  results
              in  poor  utilization of the network.  This option is overridden by TCP_CORK; however, setting this option forces an explicit flush of pending output,
              even if TCP_CORK is currently set.


But since we explicily mention "NoDelay" to "True" , When the unix socket starts, It tries to honor that option but fails because TCP_NODELAY is tcp only option. 


Workaround:

* Edit /etc/systemd/system/foreman.socket.d/installer.conf and add "NoDelay=false" at the end of the file

# cat /etc/systemd/system/foreman.socket.d/installer.conf
[Socket]
ListenStream=
ListenStream=/run/foreman.sock
SocketUser=apache
SocketMode=0600
NoDelay=false

* systemctl daemon-reload

* systemctl restart foreman.socket


Unless, my explanation is wrong or missing some important part and due to some reason, NoDelay should always be set to true in the case of foreman.socket,  I will suggest having this properly handled by satellite-installer and set "NoDelay=false" in /etc/systemd/system/foreman.socket.d/installer.conf .

Comment 1 Evgeni Golov 2022-06-21 11:09:30 UTC
Created redmine issue https://projects.theforeman.org/issues/35089 from this bug

Comment 2 Bryan Kearney 2022-06-21 12:04:49 UTC
Upstream bug assigned to egolov

Comment 3 Bryan Kearney 2022-06-21 12:04:51 UTC
Upstream bug assigned to egolov

Comment 4 Bryan Kearney 2022-06-21 16:04:54 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/35089 has been resolved.

Comment 5 Gaurav Talreja 2022-07-22 08:04:10 UTC
Hi, 

Tested on Satellite 6.12.0 Snap 3.0

Steps followed:
# foreman-maintain service restart --only foreman.socket
OR
# systemctl restart foreman.socket
# tail -f /var/log/messages
Jul 21 18:00:25 satellite.example.com systemd[1]: Closed Foreman HTTP Server Accept Sockets.
Jul 21 18:00:25 satellite.example.com systemd[1]: Stopping Foreman HTTP Server Accept Sockets.
Jul 21 18:00:25 satellite.example.com systemd[1]: foreman.socket: TCP_NODELAY failed: Operation not supported
Jul 21 18:00:25 satellite.example.com systemd[1]: Starting Foreman HTTP Server Accept Sockets.
Jul 21 18:00:25 satellite.example.com systemd[1]: Listening on Foreman HTTP Server Accept Sockets.


# grep NoDelay /usr/share/foreman/extras/systemd/foreman.socket /usr/lib/systemd/system/foreman.socket
grep: /usr/share/foreman/extras/systemd/foreman.socket: No such file or directory
/usr/lib/systemd/system/foreman.socket:NoDelay=true

In this case, it appears the issue is still present, and /etc/systemd/system/foreman.socket.d/installer.conf does not contain "NoDelay=false"
Also, /usr/share/foreman/extras/systemd/foreman.socket along with systemd/ directory does not exist in RHEL8 for both 6.12 and 6.11, is that expected?


Thanks,
Gaurav

Comment 6 Evgeni Golov 2022-08-08 07:28:16 UTC
The Foreman redmine is marked as being fixed in 3.4, not in 3.3, so this is not in "snap_6.12.0_1.0" (thus removing that flag).

If y'all want this in 6.12, you gotta pick it.

Comment 7 Gaurav Talreja 2022-09-27 21:45:49 UTC
Verified.

Tested on Satellite 6.12.0 Snap 12.0

1. # grep NoDelay /etc/systemd/system/foreman.socket.d/installer.conf
    NoDelay=false
2. # foreman-maintain service restart --only foreman.socket
OR
# systemctl restart foreman.socket
3. Verify /var/log/messages doesn't contain any message like "TCP_NODELAY failed: Operation not supported" after restart


Observation:
In /etc/systemd/system/foreman.socket.d/installer.conf, a "NoDelay=false" line is added which fixes this messages which is handled by satellite-installer.
In addition, I tried setting this to "true" and the installer always resets it to "false" again.

In comment 5, I mentioned "NoDelay=true" in below files which is still there, but it seems it doesn't cause any issues

# grep NoDelay /usr/share/foreman/extras/systemd/foreman.socket /usr/lib/systemd/system/foreman.socket
grep: /usr/share/foreman/extras/systemd/foreman.socket: No such file or directory
/usr/lib/systemd/system/foreman.socket:NoDelay=true

Comment 11 errata-xmlrpc 2022-11-16 13:34:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.12 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:8506