Google Cloud Run容器每3天因Signal 9终止重启问题求助
问题:Google Cloud Run实例每3天自动重启(承载Laravel Horizon与定时任务)
我配置了一个min=max=1且始终分配CPU的Google Cloud Run实例,用于持续运行后台任务,该实例不接收HTTP请求,具体承载Laravel Horizon服务及每隔X分钟执行的定时任务。
问题是该实例每3天会自动重启,重启前会先记录以下提示:
后续日志如下:
WARNING 2023-12-31T23:09:56.226021579Z Container terminated on signal 9. DEFAULT 2023-12-31T23:09:56.227556Z 2023-12-31 23:09:55 Running ['artisan' command:execute] in background DEFAULT 2023-12-31T23:09:57.858518Z [s6-init] making user provided files available at /var/run/s6/etc...exited 0. DEFAULT 2023-12-31T23:09:58.094845Z [s6-init] ensuring user provided files have correct perms...exited 0. DEFAULT 2023-12-31T23:09:58.101377Z [fix-attrs.d] applying ownership & permissions fixes... DEFAULT 2023-12-31T23:09:58.114547Z [fix-attrs.d] done. DEFAULT 2023-12-31T23:09:58.117210Z [cont-init.d] executing container initialization scripts... DEFAULT 2023-12-31T23:09:58.121936Z [cont-init.d] done. DEFAULT 2023-12-31T23:09:58.125717Z [services.d] starting services DEFAULT 2023-12-31T23:09:58.177808Z [services.d] done. INFO 2023-12-31T23:09:58.275042Z Default STARTUP TCP probe succeeded after 1 attempt for container "horizon-1" on port 8080. DEFAULT 2023-12-31T23:09:58.892058Z [31-Dec-2023 23:09:58] NOTICE: fpm is running, pid 201 DEFAULT 2023-12-31T23:09:58.892081Z [31-Dec-2023 23:09:58] NOTICE: ready to handle connections DEFAULT 2023-12-31T23:09:59.115109Z /usr/lib/python3.10/site-packages/supervisor/options.py:474: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. DEFAULT 2023-12-31T23:09:59.115120Z self.warnings.warn( DEFAULT 2023-12-31T23:09:59.124359Z 2023-12-31 23:09:59,124 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. DEFAULT 2023-12-31T23:09:59.124446Z 2023-12-31 23:09:59,124 WARN For [program:laravel-schedule], AUTO logging used for stderr_logfile without rollover, set maxbytes > 0 to avoid filling up filesystem unintentionally DEFAULT 2023-12-31T23:09:59.124630Z 2023-12-31 23:09:59,124 WARN For [program:horizon-run], AUTO logging used for stderr_logfile without rollover, set maxbytes > 0 to avoid filling up filesystem unintentionally DEFAULT 2023-12-31T23:09:59.125276Z 2023-12-31 23:09:59,124 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message. DEFAULT 2023-12-31T23:09:59.125681Z 2023-12-31 23:09:59,124 WARN For [program:laravel-schedule], AUTO logging used for stderr_logfile without rollover, set maxbytes > 0 to avoid filling up filesystem unintentionally DEFAULT 2023-12-31T23:09:59.125689Z 2023-12-31 23:09:59,124 WARN For [program:horizon-run], AUTO logging used for stderr_logfile without rollover, set maxbytes > 0 to avoid filling up filesystem unintentionally DEFAULT 2023-12-31T23:09:59.138177Z 2023-12-31 23:09:59,138 INFO supervisord started with pid 207 DEFAULT 2023-12-31T23:09:59.138395Z 2023-12-31 23:09:59,138 INFO supervisord started with pid 207 DEFAULT 2023-12-31T23:10:00.158832Z 2023-12-31 23:10:00,155 INFO spawned: 'laravel-schedule_00' with pid 223 DEFAULT 2023-12-31T23:10:00.159361Z 2023-12-31 23:10:00,155 INFO spawned: 'laravel-schedule_00' with pid 223 DEFAULT 2023-12-31T23:10:00.205530Z 2023-12-31 23:10:00,204 INFO spawned: 'horizon-run' with pid 225 DEFAULT 2023-12-31T23:10:00.206011Z 2023-12-31 23:10:00,204 INFO spawned: 'horizon-run' with pid 225 DEFAULT 2023-12-31T23:10:01.116437Z 2023-12-31 23:10:01 Running ['artisan' command:name] Horizon started successfully. DEFAULT 2023-12-31T23:10:01.504652Z ............ 455ms2023-12-31 23:10:01,504 INFO success: laravel-schedule_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) DEFAULT 2023-12-31T23:10:01.505008Z 2023-12-31 23:10:01,504 INFO success: horizon-run entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) DEFAULT 2023-12-31T23:10:01.505060Z 2023-12-31 23:10:01,504 INFO success: laravel-schedule_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) DEFAULT 2023-12-31T23:10:01.505331Z DONE DEFAULT 2023-12-31T23:10:01.505690Z 2023-12-31 23:10:01,504 INFO success: horizon-run entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) DEFAULT 2023-12-31T23:10:01.516709Z ⇂ Command description
日志记录后实例会恢复正常运行。
以下是相关指标截图:

备注:容器终止日志记录于2024-01-01 00:09:56,该时刻指标显示无高CPU或内存占用。
内容的提问来源于stack exchange,提问作者Orestis uRic
相关产品推荐
相关产品推荐

