Web2Py Scheduler使Postgress DB崩溃

时间:2018-10-11 11:22:14

标签: web2py web2py-modules

我正在使用调度程序作为Linux服务。

我创建了一个文件/etc/systemd/system/web2py-sched.service

[Unit]
Description=Web2Py scheduler service

[Service]
ExecStart=/usr/bin/python /home/www-data/web2py/web2py.py -K myApp
Type=simple
Restart=always
[Install]
WantedBy=multi-user.target

然后安装服务调用:

sudo systemctl enable /etc/systemd/system/web2py-sched.service 

systemctl start /etc/systemd/system/web2py-sched

现在运行一天后,我看到Postgress数据库崩溃了或apache服务器崩溃了。我无法跟踪apache日志。但是在Postgress Logs中,我发现:

2018-10-10 06:56:17 PDT [22303-1] spm@mydb LOG:  unexpected EOF on client connection with an open transaction
2018-10-10 06:56:17 PDT [18799-7] LOG:  server process (PID 22304) was terminated by signal 9: Killed
2018-10-10 06:56:17 PDT [18799-8] DETAIL:  Failed process was running: SELECT "scheduler_task"."id", "scheduler_task"."application_name", "scheduler_task"."task_name", "scheduler_task"."group_name", "scheduler_task"."status", "scheduler_task"."function_name", "scheduler_task"."uuid", "scheduler_task"."args", "scheduler_task"."vars", "scheduler_task"."enabled", "scheduler_task"."start_time", "scheduler_task"."next_run_time", "scheduler_task"."stop_time", "scheduler_task"."repeats", "scheduler_task"."retry_failed", "scheduler_task"."period", "scheduler_task"."prevent_drift", "scheduler_task"."cronline", "scheduler_task"."timeout", "scheduler_task"."sync_output", "scheduler_task"."times_run", "scheduler_task"."times_failed", "scheduler_task"."last_run_time", "scheduler_task"."assigned_worker_name" FROM "scheduler_task" WHERE (("scheduler_task"."assigned_worker_name" = 'myApp#22265') AND ("scheduler_task"."status" = 'ASSIGNED')) ORDER BY "scheduler_task"."next_run_time" LIMIT 1 OFFSET 0;
2018-10-10 06:56:17 PDT [18799-9] LOG:  terminating any other active server processes
2018-10-10 06:56:17 PDT [22256-2] WARNING:  terminating connection because of crash of another server process
2018-10-10 06:56:17 PDT [22256-3] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
2018-10-10 06:56:17 PDT [22256-4] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2018-10-10 06:56:17 PDT [18799-10] LOG:  all server processes terminated; reinitializing
2018-10-10 06:56:17 PDT [22457-1] LOG:  database system was interrupted; last known up at 2018-10-10 06:55:04 PDT
2018-10-10 06:56:18 PDT [22457-2] LOG:  database system was not properly shut down; automatic recovery in progress
2018-10-10 06:56:18 PDT [22457-3] LOG:  redo starts at 0/C1C85F94
2018-10-10 06:56:18 PDT [22457-4] LOG:  invalid record length at 0/C1C88100
2018-10-10 06:56:18 PDT [22457-5] LOG:  redo done at 0/C1C880DC
2018-10-10 06:56:18 PDT [22457-6] LOG:  last completed transaction was at log time 2018-10-10 06:56:16.925482-07
2018-10-10 06:56:18 PDT [22457-7] LOG:  MultiXact member wraparound protections are now enabled
2018-10-10 06:56:18 PDT [18799-11] LOG:  database system is ready to accept connections
2018-10-10 06:56:18 PDT [22491-1] LOG:  autovacuum launcher started
2018-10-10 06:56:31 PDT [22500-1] spm@mydb LOG:  unexpected EOF on client connection with an open transaction
2018-10-10 06:56:31 PDT [22501-1] spm@mydb LOG:  unexpected EOF on client connection with an open transaction
2018-10-10 06:56:31 PDT [22594-1] spm@mydb LOG:  unexpected EOF on client connection with an open transaction
2018-10-10 06:56:31 PDT [22595-1] spm@mydb LOG:  unexpected EOF on client connection with an open transaction
2018-10-10 06:56:33 PDT [18799-12] LOG:  autovacuum launcher process (PID 22491) was terminated by signal 9: Killed
2018-10-10 06:56:33 PDT [18799-13] LOG:  terminating any other active server processes
2018-10-10 06:56:33 PDT [18799-14] LOG:  all server processes terminated; reinitializing
2018-10-10 06:56:33 PDT [22638-1] LOG:  database system was interrupted; last known up at 2018-10-10 06:56:18 PDT
2018-10-10 06:56:33 PDT [18799-15] LOG:  startup process (PID 22638) was terminated by signal 9: Killed
2018-10-10 06:56:33 PDT [18799-16] LOG:  aborting startup due to startup process failure

我已确保所有交易均已提交。但这就像代码在调用commit之前的某个时刻退出一样。

在以上日志中:

2018-10-10 06:56:17 PDT [18799-8] DETAIL:  Failed process was running: SELECT "scheduler_task"."id", "scheduler_task"."application_name", "scheduler_task"."task_name", "scheduler_task"."group_name", "scheduler_task"."status", "scheduler_task"."function_name", "scheduler_task"."uuid", "scheduler_task"."args", "scheduler_task"."vars", "scheduler_task"."enabled", "scheduler_task"."start_time", "scheduler_task"."next_run_time", "scheduler_task"."stop_time", "scheduler_task"."repeats", "scheduler_task"."retry_failed", "scheduler_task"."period", "scheduler_task"."prevent_drift", "scheduler_task"."cronline", "scheduler_task"."timeout", "scheduler_task"."sync_output", "scheduler_task"."times_run", "scheduler_task"."times_failed", "scheduler_task"."last_run_time", "scheduler_task"."assigned_worker_name" FROM "scheduler_task" WHERE (("scheduler_task"."assigned_worker_name" = 'myApp#22265') AND ("scheduler_task"."status" = 'ASSIGNED')) ORDER BY "scheduler_task"."next_run_time" LIMIT 1 OFFSET 0;

版本

2.15.4-stable+timestamp.2017.09.02.04.02.22
(Running on Apache/2.4.18 (Ubuntu), Python 2.7.12)

1 个答案:

答案 0 :(得分:0)

首先尝试将web2py更新为当前版本(2.17.2-stable+timestamp.2018.10.06.18.54.02)。以前的版本中启动工作程序时出现问题。

在我的情况下,更新解决了调度程序问题。如果这样做不能解决问题,请告诉我。也许我还有其他建议。

最好的问候 克莱门斯