• ircd "address in use" via systemd up on crash, fills log file

    From Nigel Reed@VERT to GitLab issue in main/sbbs on Wed Apr 27 17:50:57 2022
    open https://gitlab.synchro.net/main/sbbs/-/issues/402

    I have the following systemd service file for my ircd

    ```
    [Unit]
    Description=Synchronet ircd
    After=syslog.target network.target

    [Service]
    Type=simple
    User=bbs
    Group=bbs
    #ExecStart=/sbbs/exec/jsexec -L0 -a -c /sbbs/ctrl -l -o/var/log/sbbs/ircd.log -e/var/log/sbbs/ircd.err ircd
    ExecStart=/sbbs/exec/jsexec -L7 -l /sbbs/exec/ircd.js
    #StandardOutput=syslog
    #StandardError=syslog
    SyslogIdentifier=ircd


    [Install]
    WantedBy=multi-user.target
    ```

    If the ircd crashes for some reason, it will spam the log files with:

    ```
    Apr 26 01:51:05 bbs ircd[922629]: Re-running: /sbbs/exec/ircd.js
    Apr 26 01:51:05 bbs ircd[922629]: SynchronetIRCd-1.9 started.
    Apr 26 01:51:05 bbs ircd[922629]: Trying to read configuration from: /sbbs/ctrl/ircd.conf
    Apr 26 01:51:05 bbs ircd[922629]: Creating new socket object on port 6667
    Apr 26 01:51:05 bbs ircd[922629]: 0009 !ERROR 98 binding IRCd socket to port 6667: Address already in use
    Apr 26 01:51:05 bbs ircd[922629]: !Error Error: Unable to add host to socket set creating listening socket on port 6667
    Apr 26 01:51:05 bbs ircd[922629]: !Module (/sbbs/exec/ircd.js) set exit_code: 1 ```

    This messages repeats 5-7 times per second. Left unchecked it will fill up a log in pretty short order.

    REUSEADDR = TRUE
    in sockopts.ini

    Need a fix so that the ircd will respawn.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Mon Jul 24 17:04:55 2023
    https://gitlab.synchro.net/main/sbbs/-/issues/402#note_3703

    The use of the ListeningSocket constructor appears to be the reason the sockopts.ini file setting (i.e. REUSEADDR=1) isn't being applied. This class never got the sockopts.ini support.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab issue in main/sbbs on Mon Jul 24 17:21:24 2023
    close https://gitlab.synchro.net/main/sbbs/-/issues/402

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab issue in main/sbbs on Mon Jul 24 18:37:18 2023
    reopen https://gitlab.synchro.net/main/sbbs/-/issues/402

    I have the following systemd service file for my ircd

    ```
    [Unit]
    Description=Synchronet ircd
    After=syslog.target network.target

    [Service]
    Type=simple
    User=bbs
    Group=bbs
    #ExecStart=/sbbs/exec/jsexec -L0 -a -c /sbbs/ctrl -l -o/var/log/sbbs/ircd.log -e/var/log/sbbs/ircd.err ircd
    ExecStart=/sbbs/exec/jsexec -L7 -l /sbbs/exec/ircd.js
    #StandardOutput=syslog
    #StandardError=syslog
    SyslogIdentifier=ircd


    [Install]
    WantedBy=multi-user.target
    ```

    If the ircd crashes for some reason, it will spam the log files with:

    ```
    Apr 26 01:51:05 bbs ircd[922629]: Re-running: /sbbs/exec/ircd.js
    Apr 26 01:51:05 bbs ircd[922629]: SynchronetIRCd-1.9 started.
    Apr 26 01:51:05 bbs ircd[922629]: Trying to read configuration from: /sbbs/ctrl/ircd.conf
    Apr 26 01:51:05 bbs ircd[922629]: Creating new socket object on port 6667
    Apr 26 01:51:05 bbs ircd[922629]: 0009 !ERROR 98 binding IRCd socket to port 6667: Address already in use
    Apr 26 01:51:05 bbs ircd[922629]: !Error Error: Unable to add host to socket set creating listening socket on port 6667
    Apr 26 01:51:05 bbs ircd[922629]: !Module (/sbbs/exec/ircd.js) set exit_code: 1 ```

    This messages repeats 5-7 times per second. Left unchecked it will fill up a log in pretty short order.

    REUSEADDR = TRUE
    in sockopts.ini

    Need a fix so that the ircd will respawn.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Mon Jul 24 18:39:36 2023
    https://gitlab.synchro.net/main/sbbs/-/issues/402#note_3708

    After further review, it does appear that the sockopts.ini file *should* be applied to newly created ListeningSocket() via the sock_init callback parameter (ls_cb) passed to xpms_add() in js_listening_socket_constructor(). ls_cb() in turn calls set_socket_options() and even logs an error if one occurs, so we don't expect any problem there.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Nigel Reed@VERT to GitLab note in main/sbbs on Fri Sep 1 00:05:17 2023
    https://gitlab.synchro.net/main/sbbs/-/issues/402#note_3856

    For those researching this issue, I believe it's caused by using -l with jsexec.
    The -l option will make the process repeat until terminated. I assume that means that jsexec will restart when an error occurs.

    Sep 1 01:20:50 bbs ircd[806092]: Re-running: /sbbs/exec/ircd.js

    I thought this was from systemd, however this is jsexec

    jsexec.c: lprintf(LOG_INFO,"\nRe-running: %s", module);


    By removing the -l from the jsexec process, it will terminate and allow systemd to manage restarting the process.

    ExecStart=/sbbs/exec/jsexec -L7 /sbbs/exec/ircd.js
    Restart=always
    RestartSec=15

    After I did a /die it tried to start, waited and started right up.

    If others can check and confirm, then the wiki ircd instructions can be updated. It may be noted that js.time_limit may need to be set to avoid getting an endless loop exit, which I wonder is what is causing a number of ircd to disconnect and reconnect, but that's another investigation.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net