服务部署失败问题排查

收藏
我的收藏

介绍

当服务部署失败时,可以通过查看部署日志来进行问题排查。本文将列举一些常见的服务部署失败的问题,帮助您更快的进行问题排查。

端口监听错误- Function listen wrong port: xxxx, you should listen on 8000

描述:端口没有监听在 8000
错误日志:
... [FaaS System] Received load request. [FaaS System] Function listen wrong port: 8001, you should listen on 8000 [FaaS System] Stop waiting for function to start, error_code: "function_cold_start_timeout", error_message "Function listen wrong port: 8001, you should listen on 8000", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_cold_start_timeout", error_message "Function listen wrong port: 8001, you should listen on 8000", request_id: "". [FaaS System] Failed to load function, error_code: "function_cold_start_timeout", error_message "Function listen wrong port: 8001, you should listen on 8000", request_id: "update_046453fb-a432-4cf7-8146-49cc198aaa73". [FaaS System] Function process exit unexpectedly, exit info: <nil>. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "", request_id: "", send to 0 receivers. [FaaS System] Sent notify to retry start function. [FaaS System] Try to retry starting function, retries 1. [FaaS System] Start function process. [FaaS System] Killed function. [FaaS System] Sent notify to start function. ....
解决办法:请确保服务启动监听在 8000 端口。

端口未监听

描述:程序没有监听任何端口
解决办法:请确保服务启动监听在 8000 端口。

缺少 run.sh- /opt/application/run.sh: No such file or directory

描述:服务缺少 run.sh 执行文件,抖音云依赖 run.sh 启动服务。
错误日志:
[FaaS System] starting runtime agent control plane server at port 9000... [FaaS System] starting data agent... [FaaS System] starting runtime agent data plane server at port 9001... [FaaS System] Received load request. [FaaS System] Update Route with function meta. [FaaS System] Start function process. [FaaS System] Sent notify to start function. [FaaS System] Try to start function bash: line 1: /opt/application/run.sh: No such file or directory [FaaS System] Run function error: exit status 127, error message: Function has no run.sh or file path is wrong. [FaaS System] Function exited, exit info: exit status 127. [FaaS System] Function process exit unexpectedly, exit info: exit status 127. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "Function has no run.sh or file path is wrong", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_exited", error_message "Function has no run.sh or file path is wrong", request_id: "". [FaaS System] Failed to load function, error_code: "function_exited", error_message "Function has no run.sh or file path is wrong", request_id: "update_2a7bd987-7960-44cb-b11e-72a4e86c372c".
解决办法:请将服务的启动命令写在 run.sh 执行文件下,具体要求参考:代码规范详情

run.sh 路径错误- /opt/application/run.sh: No such file or directory

描述:run.sh 路径错误,无法执行启动命令。
解决办法:抖音云托管默认会读取/opt/application/run.sh执行文件,请检查对应的Dockerfile,确保run.sh路径正确。

run.sh 缺少可执行权限- /opt/application/run.sh: Permission denied

描述:run.sh 缺少可执行权限,需要在项目启动的 Dockerfile 中增加chmod a+x run.sh赋予可执行权限。
错误日志:
[FaaS System] starting data agent... [FaaS System] starting runtime agent data plane server at port 9001... [FaaS System] starting runtime agent control plane server at port 9000... [FaaS System] Received load request. [FaaS System] Update Route with function meta. [FaaS System] Start function process. [FaaS System] Sent notify to start function. [FaaS System] Try to start function bash: line 1: /opt/application/run.sh: Permission denied [FaaS System] Function exited, exit info: exit status 126. [FaaS System] Run function error: exit status 126, error message: run.sh has no execution permission. [FaaS System] Function process exit unexpectedly, exit info: exit status 126. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "". [FaaS System] Failed to load function, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "update_c0a19422-6a07-4f77-94a3-0e612855699d". [FaaS System] Received load request. [FaaS System] Start function process. [FaaS System] Sent notify to start function. [FaaS System] Try to start function bash: line 1: /opt/application/run.sh: Permission denied [FaaS System] Function exited, exit info: exit status 126. [FaaS System] Run function error: exit status 126, error message: run.sh has no execution permission. [FaaS System] Function process exit unexpectedly, exit info: exit status 126. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "". [FaaS System] Failed to load function, error_code: "function_exited", error_message "run.sh has no execution permission", request_id: "20230702180950A0E500EA8558CD582A8B".

服务启动时间过长- Function start too long, still not listen on port

描述:服务 main 函数启动时间过长,可能卡在某个步骤,导致 8000 端口尚未监听,无法发起连接。
错误日志:
[FaaS System] starting runtime agent control plane server at port 9000... [FaaS System] starting data agent... [FaaS System] starting runtime agent data plane server at port 9001... [FaaS System] Received load request. [FaaS System] Update Route with function meta. [FaaS System] Start function process. [FaaS System] Sent notify to start function. [FaaS System] Try to start function ++ dirname /opt/application/run.sh + cd /opt/application + '[' -d output ']' + exec ./main [FaaS System] Received load request. [FaaS System] Start function process. [FaaS System] Sent notify to start function. [FaaS System] Function start too long, still not listen on any port [FaaS System] Stop waiting for function to start, error_code: "function_cold_start_timeout", error_message "Function start too long, still not listen on any port", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_cold_start_timeout", error_message "Function start too long, still not listen on any port", request_id: "". [FaaS System] Failed to load function, error_code: "function_cold_start_timeout", error_message "Function start too long, still not listen on any port", request_id: "update_2e1b7de3-539c-44cf-898d-ba227c038bd1". [FaaS System] Killed function. [FaaS System] Function process exit unexpectedly, exit info: <nil>. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_exited", error_message "", request_id: "". [FaaS System] Failed to load function, error_code: "function_exited", error_message "", request_id: "202307021842114F94B616B3A290569888". [FaaS System] Try to start function ++ dirname /opt/application/run.sh + cd /opt/application + '[' -d output ']' + exec ./main

服务启动发生 panic- Function panic and maybe it has no listening port

描述:服务启动过程中发生 Panic
错误日志:
.... [FaaS System] Run function error: exit status 2, error message: Function panic and maybe it has no listening port. [FaaS System] Function exited, exit info: exit status 2. [FaaS System] Function process exit unexpectedly, exit info: exit status 2. [FaaS System] Stop waiting for function to start, error_code: "function_exited", error_message "Function panic and maybe it has no listening port", request_id: "", send to 1 receivers. [FaaS System] Failed to wait for function to start, error_code: "function_exited", error_message "Function panic and maybe it has no listening port", request_id: "". [FaaS System] Failed to load function, error_code: "function_exited", error_message "Function panic and maybe it has no listening port", request_id: "update_ef05b882-9762-43bb-8ec9-f4d577016de1". ....
解决办法:根据服务日志定位服务启动过程中发生异常崩溃的原因,比如:
    服务编译报错,开发者可以在本地测试自己Dockerfile是否可以正确编译。
    服务启动时初始化连接外网的数据库资源,但是服务未开启外网访问,会导致网络不通导致初始化失败。

Failed to find interpreter: bash, use sh instead. Error: exec: "bash": executable file not found in $PATH

描述:未找到bash,切换至sh使用。该错误信息不会导致部署失败,可忽略。