Vsmagent does not start if you configure bad syslog server

When you enable syslog in /opt/thinlinc/etc/conf.d/vsmagent.hconf and sets syslog_host=syslog.
If “syslog” is not resolvable, the server crashes on startup.

# systemctl status vsmagent 
● vsmagent.service - ThinLinc VSM agent
   Loaded: loaded (/usr/lib/systemd/system/vsmagent.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Mon 2022-09-26 19:51:45 CEST; 5min ago
  Process: 3402 ExecStart=/bin/bash --login -c /opt/thinlinc/sbin/vsmagent (code=exited, status=0/SUCCESS)

Sep 26 19:50:15 thinlinc systemd[1]: Starting ThinLinc VSM agent...
Sep 26 19:50:15 thinlinc systemd[1]: vsmagent.service: Can't open PID file /var/run/vsmagent.pid (yet?) after start: No such file or directory
Sep 26 19:51:45 thinlinc systemd[1]: vsmagent.service: start operation timed out. Terminating.
Sep 26 19:51:45 thinlinc systemd[1]: vsmagent.service: Failed with result 'timeout'.
Sep 26 19:51:45 thinlinc systemd[1]: Failed to start ThinLinc VSM agent.

The /var/log/vsmagent.log is a bit clearer …


  File "/opt/thinlinc/sbin/vsmagent", line 18, in <module>
    OOoOoo000O00 ( )
  File "/opt/thinlinc/sbin/vsmagent", line 15, in OOoOoo000O00
    VSMAgent ( sys . argv )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmagent.py", line 116, in __init__
    self . setup_logging ( )
  File "/opt/thinlinc/modules/thinlinc/vsm/vsmagent.py", line 174, in setup_logging
    fd = sys . stdout )
  File "/opt/thinlinc/modules/thinlinc/tllogger.py", line 92, in __init__
    i1Ii1iiIiI111 = logging . handlers . SysLogHandler ( Oo0 , Ooo00ooO )
  File "/usr/lib64/python3.6/logging/handlers.py", line 837, in __init__
    ress = socket.getaddrinfo(host, port, 0, socktype)
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 1946, in shutdown
    h.close()
  File "/usr/lib64/python3.6/logging/handlers.py", line 900, in close
    self.socket.close()
AttributeError: 'SysLogHandler' object has no attribute 'socket'

How about a nice message like “vsmagent can’t resolv syslog, exiting…” :slight_smile:

Hi @pewo

Thanks for the report! Indeed, this could be handled a lot nicer. Would you mind reporting this in our
bugzilla?

Kind regards,
Martin

Maybe it’s not a bug that the agent won’t start when incorrect config is entered.
I will go for RFE :slight_smile:

I will report in bugzilla soon.

Great @pewo !

There’s a maintenance window right now for our Bugzilla, but it should be available shortly :slight_smile:

Regards,
Martin

https://bugzilla.cendio.com/show_bug.cgi?id=7999

1 Like

Great! Thank you for the bonus suggestion as well :slight_smile: Greatly appreciated!

Regards,
Martin