• Sighting: background timed event causes event thread to hang (not exec

    From Rob Swindell@VERT to GitLab note in main/sbbs on Thursday, November 07, 2024 12:04:32
    https://gitlab.synchro.net/main/sbbs/-/issues/661#note_5929

    I've seen this happen a couple of times recently (again on git.synchro.net) where my FIDOIN timed event configured to run in the Background did this same thing: hung the event thread, but never actually executed.

    Again, the `Detaching external process` log message was conspicuously absent.

    Also interesting, a restart of the sbbs service appears to gracefully shutdown the bbs_thread, which waits (forever) for the event_thread() to terminate, and it does. So if external() is indefinitely blocked in this scenario (as it appears), it gets unblocked when bbs_thread() is terminated (or recycled? I should try that too).

    I've added a bunch of debug-level log messages to external() to hopefully narrow down the point of blockage if/when this happens again.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Tuesday, November 12, 2024 23:18:30
    https://gitlab.synchro.net/main/sbbs/-/issues/661#note_5998

    Reproduced this again today, but with an instrumented external() function in xtrn.cpp. It logged this before apparently hanging:
    ```
    2024-11-12T22:37:17.472118-08:00 git sbbs: evnt FIDOIN Running native background timed event: FIDOIN
    2024-11-12T22:37:17.472152-08:00 git sbbs: evnt FIDOIN Executing external: /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472167-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1173 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472179-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1730 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472189-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1743 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472821-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1847 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472849-08:00 git sbbs: evnt FIDOIN xtrn.cpp 2018 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.472998-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1756 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.473017-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1765 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.473027-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1827 /sbbs/exec/sbbsecho -les!y
    2024-11-12T22:37:17.473038-08:00 git sbbs: evnt FIDOIN xtrn.cpp 1830 /sbbs/exec/sbbsecho -les!y
    ```
    Lines 1827 - 1830 are these in that (modified version of) xtrn.cpp:
    ```
    lprintf(LOG_DEBUG, "%s %d %s", __FILE__, __LINE__, cmdline);
    if(mode&EX_BG) /* background execution, detach child */
    {
    lprintf(LOG_DEBUG, "%s %d %s", __FILE__, __LINE__, cmdline);
    lprintf(LOG_INFO,"Detaching external process");
    if(daemon(TRUE,FALSE) != 0)
    lprintf(LOG_ERR, "!ERROR %d (%s) daemonizing: %s", errno, strerror(errno), argv[0]);
    }
    ```

    So it appears to successfully log the last DEBUG line there, but not the "Detaching external process" line.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Tuesday, November 12, 2024 23:30:55
    https://gitlab.synchro.net/main/sbbs/-/issues/661#note_5999

    Looks like the parent of the fork() was stuck in this loop:
    `while(waitpid(pid, &i, WNOHANG)==0) {`

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