You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When freeswitch is started, switch.c calls daemonize which closes stderr in the child process. If -ncwait is passed, the parent creates a pipe before spawning the child and waits for the child to send it a 1 to indicate it started.
In between the call to daemonize and the write to the pipe by the child, various things could go wrong which cause it to just write to stderr and then exit, so the parent knows it failed, but not why.
Given stderr is dropped in the child, these errors are dumped into /dev/null and there’s no way to know what they were.
If the error is reproducible, you can start freeswitch in the foreground and see what it is. In my case, freeswitch is randomly failing to start at boot, and starting in foreground after boot works fine. But since the instance started at boot doesn't log why it failed anywhere, I can't figure out why it sometimes won't start.
To Reproduce
This is a contrived example of a static error in the config. Obviously you can just start in foreground and see what it is. But it demonstrates how when started in background there's no way to tell what failed:
Say for example /etc/freeswitch/freeswitch.xml doesn’t exist. freeswitch fails to start:
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Scheduled restart job, restart counter is at 5.
Jun 29 19:50:22 pbx-01 systemd[1]: Stopped freeswitch.service - freeswitch.
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Start request repeated too quickly.
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Failed with result ‘exit-code’.
Jun 29 19:50:22 pbx-01 systemd[1]: Failed to start freeswitch.service - freeswitch.
There’s nothing in the freeswitch log, the last entry is from being shut down before this test:
2024-06-29 19:50:06.562165 99.27% [NOTICE] switch_loadable_module.c:1573 Deleting Say interface ‘en’
There’s also nothing in the journal:
pbx-01 ~ # journalctl -xeu freeswitch.service
A start job for unit freeswitch.service has finished with a failure.
The job identifier is 3988 and the job result is failed.
Expected behavior
If freeswitch fails to start, any output to stderr should show up in systemd logs
Hmm, I never have an issue starting once the box is up. It only fails during boot (probably a race condition of some kind, but without a log of what fails I dunno what). I don't think #2743 is necessarily the same as this as it appears in that case sometimes it freezes when started up manually.
Describe the bug
When freeswitch is started, switch.c calls daemonize which closes stderr in the child process. If -ncwait is passed, the parent creates a pipe before spawning the child and waits for the child to send it a 1 to indicate it started.
In between the call to daemonize and the write to the pipe by the child, various things could go wrong which cause it to just write to stderr and then exit, so the parent knows it failed, but not why.
Given stderr is dropped in the child, these errors are dumped into /dev/null and there’s no way to know what they were.
If the error is reproducible, you can start freeswitch in the foreground and see what it is. In my case, freeswitch is randomly failing to start at boot, and starting in foreground after boot works fine. But since the instance started at boot doesn't log why it failed anywhere, I can't figure out why it sometimes won't start.
To Reproduce
This is a contrived example of a static error in the config. Obviously you can just start in foreground and see what it is. But it demonstrates how when started in background there's no way to tell what failed:
Say for example /etc/freeswitch/freeswitch.xml doesn’t exist. freeswitch fails to start:
pbx-01 ~ # systemctl status freeswitch.service
× freeswitch.service - freeswitch
Loaded: loaded (/lib/systemd/system/freeswitch.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2024-06-29 19:50:22 PDT; 30s ago
Duration: 52.239s
Process: 6000 ExecStart=/usr/bin/freeswitch -u ${USER} -g ${GROUP} -ncwait ${DAEMON_OPTS} (code=exited, s>
CPU: 44ms
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Scheduled restart job, restart counter is at 5.
Jun 29 19:50:22 pbx-01 systemd[1]: Stopped freeswitch.service - freeswitch.
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Start request repeated too quickly.
Jun 29 19:50:22 pbx-01 systemd[1]: freeswitch.service: Failed with result ‘exit-code’.
Jun 29 19:50:22 pbx-01 systemd[1]: Failed to start freeswitch.service - freeswitch.
There’s nothing in the freeswitch log, the last entry is from being shut down before this test:
2024-06-29 19:50:06.562165 99.27% [NOTICE] switch_loadable_module.c:1573 Deleting Say interface ‘en’
There’s also nothing in the journal:
pbx-01 ~ # journalctl -xeu freeswitch.service
A start job for unit freeswitch.service has finished with a failure.
The job identifier is 3988 and the job result is failed.
Expected behavior
If freeswitch fails to start, any output to stderr should show up in systemd logs
Package version or git hash
freeswitch/experimental,now 1.10.12-release-10222002881-a88d069d6f~bookworm
The text was updated successfully, but these errors were encountered: