Janus blocked from restarting if STUN server is unavailable
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- linux, python
- 领域
- devops, infrastructure
调研方向
Start with debian-pkg/usr/share/tinypilot/janus.service, then inspect the Python code path that invokes /usr/sbin/service janus restart. Reproduce the repeated-failure behavior with systemctl and journalctl, and compare it with the documented systemctl reset-failed workaround. Done means Janus can be restarted after a failed STUN startup without waiting for systemd or manually resetting the failed state.
由索引模型根据 Issue 内容生成。
描述
We already discovered the (rather unfortunate) Janus startup behavior, where Janus would refuse to come up altogether if the STUN server is not available/reachable at startup time, or if the network server is not available yet.
Steps to reproduce
- Configure Janus with an invalid or unreachable STUN server
- Restart the Janus service to apply changes (
systemctl restart janus) - Open the Janus service logs (
journalctl -f -u janus) and watch systemd trying to start Janus for 20 times - Then systemd flags Janus as
failed - Now, configure Janus with a valid and reachable STUN server
- Restart the Janus service
Systemd now refuses to restart Janus, since it’s flagged as failed. Only after a grace period of a few minutes, systemd accepts startup requests again.
So during failed state, you wouldn’t even be able to revoke the STUN config, or make any other config change to Janus.
More info
With this fix we implemented a workaround that focusses on the scenario with the network service.
There is another problem resulting from this, however: if the user specifies a STUN server that is either not present at all, or down for a longer time, then systemd will try to start Janus 20 times.
After 20 failures, systemd flags the Janus service as failed, so issuing systemctl restart janus or the like doesn’t have any effect.
You can see this in the logs below: at 16:15:11, it tries to start Janus for the 20th time, which fails at 16:15:17. After that, I periodically and manually try to restart the service via /usr/sbin/service janus restart (which is the command we normally use from our Python code), e.g. at 16:15:17, then at 16:16:09, then at 16:16:37, and so on. All those invocations fail right away, because the service is in failed state.
At 16:18:13, however, systemd starts to accept start requests again. Note that this is roughly 180 seconds / 3 minutes after the 20th automated (but failed) startup attempt.
The only way to bypass this blockage and recover the service is by manually issuing systemctl reset-failed janus. That immediately revokes the failed flag. This functionality isn’t available via /usr/sbin/service, however.
Either way, I’m not sure we have fully understood all the different start intervals and retry settings of systemd.
Oct 05 16:15:11 raspberrypi janus[4585]: ---------------------------------------------------
Oct 05 16:15:11 raspberrypi janus[4585]: Starting Meetecho Janus (WebRTC Server) v1.0.1
Oct 05 16:15:11 raspberrypi janus[4585]: ---------------------------------------------------
Oct 05 16:15:11 raspberrypi janus[4585]: Checking command line arguments...
Oct 05 16:15:11 raspberrypi janus[4585]: Debug/log level is 4
Oct 05 16:15:11 raspberrypi janus[4585]: Debug/log timestamps are disabled
Oct 05 16:15:11 raspberrypi janus[4585]: Debug/log colors are disabled
Oct 05 16:15:11 raspberrypi janus[4585]: Using 192.168.2.2 as local IP...
Oct 05 16:15:11 raspberrypi janus[4585]: Token based authentication disabled
Oct 05 16:15:11 raspberrypi janus[4585]: Initializing recorder code
Oct 05 16:15:11 raspberrypi janus[4585]: Initializing ICE stuff (Full mode, ICE-TCP candidates disabled, half-trickle, IPv6 support disabled)
Oct 05 16:15:11 raspberrypi janus[4585]: STUN server to use: stun.ucsb.edu:3478
Oct 05 16:15:11 raspberrypi janus[4585]: >> 128.111.24.49:3478 (IPv4)
Oct 05 16:15:11 raspberrypi janus[4585]: Testing STUN server: message is of 20 bytes
Oct 05 16:15:16 raspberrypi janus[4585]: [FATAL] [ice.c:janus_ice_test_stun_server:1078] No response to our STUN BINDING test
Oct 05 16:15:16 raspberrypi janus[4585]: [FATAL] [janus.c:main:4988] Invalid STUN address stun.ucsb.edu:3478
Oct 05 16:15:16 raspberrypi janus[4584]: Error launching Janus (error code 1), check the logs for more details
Oct 05 16:15:16 raspberrypi systemd[1]: janus.service: Control process exited, code=exited, status=1/FAILURE
Oct 05 16:15:16 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:15:16 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:15:17 raspberrypi systemd[1]: janus.service: Scheduled restart job, restart counter is at 20.
Oct 05 16:15:17 raspberrypi systemd[1]: Stopped Janus WebRTC gateway.
Oct 05 16:15:17 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:15:17 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:15:17 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:09 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:09 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:09 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:37 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:37 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:37 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:41 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:41 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:41 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:48 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:48 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:48 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:52 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:52 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:52 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:16:55 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:16:55 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:16:55 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:02 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:02 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:02 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:06 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:06 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:06 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:09 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:09 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:09 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:18 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:18 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:18 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:25 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:25 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:25 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:34 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:34 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:34 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:51 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:51 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:51 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:17:58 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:17:58 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:17:58 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:18:07 raspberrypi systemd[1]: janus.service: Start request repeated too quickly.
Oct 05 16:18:07 raspberrypi systemd[1]: janus.service: Failed with result 'exit-code'.
Oct 05 16:18:07 raspberrypi systemd[1]: Failed to start Janus WebRTC gateway.
Oct 05 16:18:13 raspberrypi systemd[1]: Starting Janus WebRTC gateway...
Oct 05 16:18:13 raspberrypi janus[4722]: Janus version: 1001 (1.0.1)
Oct 05 16:18:13 raspberrypi janus[4722]: Janus commit: not-a-git-repo
Oct 05 16:18:13 raspberrypi janus[4722]: Compiled on: Mon May 2 06:19:49 UTC 2022
Oct 05 16:18:13 raspberrypi janus[4722]: Running Janus as a daemon
Oct 05 16:18:13 raspberrypi janus[4723]: Logger plugins folder: /usr/lib/arm-linux-gnueabihf/janus/loggers
Oct 05 16:18:13 raspberrypi janus[4723]: [WARN] Logger plugin 'libjanus_jsonlog.so' has been disabled, skipping...
Oct 05 16:18:13 raspberrypi janus[4723]: ---------------------------------------------------
Oct 05 16:18:13 raspberrypi janus[4723]: Starting Meetecho Janus (WebRTC Server) v1.0.1
Oct 05 16:18:13 raspberrypi janus[4723]: ---------------------------------------------------
Oct 05 16:18:13 raspberrypi janus[4723]: Checking command line arguments...
Oct 05 16:18:13 raspberrypi janus[4723]: Debug/log level is 4
Oct 05 16:18:13 raspberrypi janus[4723]: Debug/log timestamps are disabled
Oct 05 16:18:13 raspberrypi janus[4723]: Debug/log colors are disabled
Oct 05 16:18:13 raspberrypi janus[4723]: Using 192.168.2.2 as local IP...
Oct 05 16:18:13 raspberrypi janus[4723]: Token based authentication disabled
Oct 05 16:18:13 raspberrypi janus[4723]: Initializing recorder code
- 主要语言
- Python
- 星标
- 3.5k
- 派生
- 292
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tiny-pilot/tinypilot 的其他 Issue
-
bug medium
难度 2/5 1-3 小时 新手友好度 62/100
tiny-pilot/tinypilot#1419 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
tiny-pilot/tinypilot#1929 · 3 条评论 ·
-
bug
难度 3/5 1-2 天 新手友好度 35/100
tiny-pilot/tinypilot#1899 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
tiny-pilot/tinypilot#1896 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
tiny-pilot/tinypilot#1882 ·
查看 tiny-pilot/tinypilot 的全部 Issue
相似的 Issue
-
adr
难度 2/5 1-3 小时 新手友好度 72/100
kristofdegrave/homeassistant-smart-charging#1607 ·
维护者通常 1 天内回复
-
namespace operations
难度 2/5 1-3 小时 新手友好度 64/100
EclipseFdn/open-vsx.org#13665 ·
维护者通常 1 天内回复
-
doc good first issue help wanted
难度 2/5 1-3 小时 新手友好度 68/100
collective/icalendar#1865 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
canonical/opentelemetry-collector-operator#409 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
mozilla/addons-release-tests#1243 ·
维护者通常 1 天内回复