Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ERROR: duplicate key value violates unique constraint "unique_job_executions" #2679

Open
LaguaFluc opened this issue Mar 25, 2025 · 1 comment
Assignees

Comments

@LaguaFluc
Copy link

Contact Information

1754860514@qq.com

MaxKB Version

1.10.1,maxkb-v1.10.1-lts-offline

Problem Description

docker运行了maxkb的容器之后,当天启动的镜像,过几天就会自动重启,不知道为什么。

有的时候重启,还是无法访问网页,于是我就去网上找了相关的方法:
https://blog.csdn.net/m0_59704905/article/details/145626973
https://bbs.fit2cloud.com/t/topic/8690

参考步骤:

  1. docker start maxkb
  2. docker exec -it maxkb bash
  3. python main.py dev celery
  4. 访问http://192.168.0.147:8880/ui/login

之后就能够访问了,然后就能够访问了。

之后会出现新的问题:不知道是否是因为下面的日志报错信息还是其他的,我当前访问http://192.168.0.147:8880/ui/login这个页面去对话,非常慢,当我在应用-选择某一个应用-设置界面对话的时候经常会返回`抱歉,当前正在维护,无法提供服务,请稍后再试!` 之类的消息返回。

请问有什么解决方案吗?我知道ERROR: duplicate key value violates unique constraint "unique_job_executions"是由于postgresql报错了,但是不知道怎样去解决?有人遇到同样的问题吗?这个error会导致我最后请求速度变慢吗?
会返回抱歉,当前正在维护,无法提供服务,请稍后再试! 这种信息吗?

Steps to Reproduce

  1. docker run -d
    --name=maxkb
    --publish 8880:8080
    --volume ./maxkb/data:/var/lib/postgresql/data
    --volume ./maxkb/model:/opt/maxkb/model/embedding
    docker.1panel.live/1panel/maxkb
  2. docker exec -it maxkb bash
  3. python main.py dev celery
  4. 访问网页出现,找到应用-对话,会产生这个问题。

The expected correct result

No response

Related log output

2025-03-19 00:00:00.311 CST [99164] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 00:00:00.311 CST [99164] DETAIL:  Key (job_id, run_time)=(access_num_reset, 2025-03-18 16:00:00+00) already exists.
2025-03-19 00:00:00.311 CST [99164] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-19T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 00:00:00.311 CST [99165] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 00:00:00.311 CST [99165] DETAIL:  Key (job_id, run_time)=(access_num_reset, 2025-03-18 16:00:00+00) already exists.
2025-03-19 00:00:00.311 CST [99165] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-19T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 00:03:38.333 CST [99159] LOG:  checkpoint starting: time
2025-03-19 00:03:39.694 CST [99159] LOG:  checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.271 s, sync=0.019 s, total=1.361 s; sync files=13, longest=0.008 s, average=0.002 s; distance=32 kB, estimate=35 kB
2025-03-19 00:08:38.739 CST [99159] LOG:  checkpoint starting: time
2025-03-19 00:08:39.877 CST [99159] LOG:  checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.037 s, sync=0.025 s, total=1.138 s; sync files=12, longest=0.016 s, average=0.003 s; distance=19 kB, estimate=33 kB
2025-03-19 02:00:00.024 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 02:00:00.024 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-18 18:00:00+00) already exists.
2025-03-19 02:00:00.024 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-19T02:00:00+08:00'::timestamptz, 0.0155360000000000, 1742320800.01554, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 02:03:40.780 CST [99159] LOG:  checkpoint starting: time
2025-03-19 02:03:41.874 CST [99159] LOG:  checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.022 s, sync=0.026 s, total=1.095 s; sync files=12, longest=0.017 s, average=0.003 s; distance=25 kB, estimate=33 kB
2025-03-20 00:00:00.443 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:00:00.443 CST [99174] DETAIL:  Key (job_id, run_time)=(access_num_reset, 2025-03-19 16:00:00+00) already exists.
2025-03-20 00:00:00.443 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Executed', '2025-03-20T00:00:00+08:00'::timestamptz, 0.412810000000000, 1742400000.41281, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:00:00.443 CST [99164] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:00:00.443 CST [99164] DETAIL:  Key (job_id, run_time)=(access_num_reset, 2025-03-19 16:00:00+00) already exists.
2025-03-20 00:00:00.443 CST [99164] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-20T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:04:03.123 CST [99159] LOG:  checkpoint starting: time
2025-03-20 00:04:05.182 CST [99159] LOG:  checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.936 s, sync=0.044 s, total=2.041 s; sync files=17, longest=0.024 s, average=0.003 s; distance=35 kB, estimate=35 kB
2025-03-20 00:05:00.026 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:05:00.026 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-19 16:05:00+00) already exists.
2025-03-20 00:05:00.026 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-20T00:05:00+08:00'::timestamptz, 0.0192530000000000, 1742400300.01925, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:09:03.208 CST [99159] LOG:  checkpoint starting: time
2025-03-20 00:09:04.426 CST [99159] LOG:  checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.082 s, sync=0.033 s, total=1.218 s; sync files=12, longest=0.017 s, average=0.003 s; distance=24 kB, estimate=34 kB
2025-03-20 02:00:00.035 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 02:00:00.035 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-19 18:00:00+00) already exists.
2025-03-20 02:00:00.035 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-20T02:00:00+08:00'::timestamptz, 0.0273880000000000, 1742407200.02739, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 02:04:05.230 CST [99159] LOG:  checkpoint starting: time
2025-03-20 02:04:07.043 CST [99159] LOG:  checkpoint complete: wrote 20 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.723 s, sync=0.028 s, total=1.814 s; sync files=16, longest=0.005 s, average=0.002 s; distance=52 kB, estimate=52 kB
2025-03-21 00:00:00.067 CST [99165] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-21 00:00:00.067 CST [99165] DETAIL:  Key (job_id, run_time)=(access_num_reset, 2025-03-20 16:00:00+00) already exists.
2025-03-21 00:00:00.067 CST [99165] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-21T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-21 00:04:27.321 CST [99159] LOG:  checkpoint starting: time
2025-03-21 00:04:29.054 CST [99159] LOG:  checkpoint complete: wrote 19 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.627 s, sync=0.041 s, total=1.734 s; sync files=16, longest=0.026 s, average=0.003 s; distance=50 kB, estimate=52 kB
2025-03-21 00:05:00.021 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-21 00:05:00.021 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-20 16:05:00+00) already exists.
2025-03-21 00:05:00.021 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-21T00:05:00+08:00'::timestamptz, 0.0161870000000000, 1742486700.01619, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-21 00:09:27.154 CST [99159] LOG:  checkpoint starting: time
2025-03-21 00:09:28.729 CST [99159] LOG:  checkpoint complete: wrote 17 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.425 s, sync=0.027 s, total=1.575 s; sync files=14, longest=0.016 s, average=0.002 s; distance=25 kB, estimate=49 kB
2025-03-21 02:04:29.219 CST [99159] LOG:  checkpoint starting: time
2025-03-21 02:04:30.394 CST [99159] LOG:  checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.120 s, sync=0.025 s, total=1.175 s; sync files=13, longest=0.018 s, average=0.002 s; distance=19 kB, estimate=46 kB
2025-03-22 00:04:51.511 CST [99159] LOG:  checkpoint starting: time
2025-03-22 00:04:52.818 CST [99159] LOG:  checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.221 s, sync=0.036 s, total=1.308 s; sync files=13, longest=0.018 s, average=0.003 s; distance=34 kB, estimate=45 kB
2025-03-22 00:05:00.031 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-22 00:05:00.031 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-21 16:05:00+00) already exists.
2025-03-22 00:05:00.031 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-22T00:05:00+08:00'::timestamptz, 0.0189400000000000, 1742573100.01894, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-22 00:09:51.917 CST [99159] LOG:  checkpoint starting: time
2025-03-22 00:09:53.080 CST [99159] LOG:  checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.037 s, sync=0.061 s, total=1.163 s; sync files=12, longest=0.028 s, average=0.006 s; distance=24 kB, estimate=43 kB
2025-03-22 02:00:00.033 CST [99172] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-22 02:00:00.033 CST [99172] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-21 18:00:00+00) already exists.
2025-03-22 02:00:00.033 CST [99172] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-22T02:00:00+08:00'::timestamptz, 0.0238670000000000, 1742580000.02387, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-22 02:04:52.612 CST [99159] LOG:  checkpoint starting: time
2025-03-22 02:04:53.615 CST [99159] LOG:  checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.929 s, sync=0.018 s, total=1.004 s; sync files=12, longest=0.008 s, average=0.002 s; distance=25 kB, estimate=41 kB
2025-03-23 00:00:13.871 CST [99159] LOG:  checkpoint starting: time
2025-03-23 00:00:15.268 CST [99159] LOG:  checkpoint complete: wrote 16 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.326 s, sync=0.037 s, total=1.397 s; sync files=14, longest=0.012 s, average=0.003 s; distance=28 kB, estimate=40 kB
2025-03-23 00:05:00.036 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-23 00:05:00.036 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-22 16:05:00+00) already exists.
2025-03-23 00:05:00.036 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-23T00:05:00+08:00'::timestamptz, 0.0220040000000000, 1742659500.02200, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-23 00:05:13.304 CST [99159] LOG:  checkpoint starting: time
2025-03-23 00:05:14.792 CST [99159] LOG:  checkpoint complete: wrote 17 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.430 s, sync=0.017 s, total=1.489 s; sync files=15, longest=0.011 s, average=0.002 s; distance=39 kB, estimate=40 kB
2025-03-23 02:00:00.028 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-23 02:00:00.028 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-22 18:00:00+00) already exists.
2025-03-23 02:00:00.028 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-23T02:00:00+08:00'::timestamptz, 0.0203840000000000, 1742666400.02038, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-23 02:00:15.719 CST [99159] LOG:  checkpoint starting: time
2025-03-23 02:00:16.973 CST [99159] LOG:  checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.127 s, sync=0.059 s, total=1.255 s; sync files=12, longest=0.025 s, average=0.005 s; distance=26 kB, estimate=38 kB
2025-03-24 00:00:37.127 CST [99159] LOG:  checkpoint starting: time
2025-03-24 00:00:38.410 CST [99159] LOG:  checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.144 s, sync=0.052 s, total=1.284 s; sync files=13, longest=0.033 s, average=0.004 s; distance=27 kB, estimate=37 kB
2025-03-24 00:05:00.025 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-24 00:05:00.025 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-23 16:05:00+00) already exists.
2025-03-24 00:05:00.025 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-24T00:05:00+08:00'::timestamptz, 0.0183500000000000, 1742745900.01835, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-24 00:05:37.455 CST [99159] LOG:  checkpoint starting: time
2025-03-24 00:05:38.796 CST [99159] LOG:  checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.241 s, sync=0.021 s, total=1.341 s; sync files=14, longest=0.009 s, average=0.002 s; distance=42 kB, estimate=42 kB
2025-03-24 02:00:00.021 CST [99172] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-24 02:00:00.021 CST [99172] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-23 18:00:00+00) already exists.
2025-03-24 02:00:00.021 CST [99172] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-24T02:00:00+08:00'::timestamptz, 0.0129430000000000, 1742752800.01294, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-24 02:00:39.683 CST [99159] LOG:  checkpoint starting: time
2025-03-24 02:00:40.851 CST [99159] LOG:  checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.121 s, sync=0.016 s, total=1.169 s; sync files=13, longest=0.010 s, average=0.002 s; distance=29 kB, estimate=41 kB
2025-03-25 00:01:01.809 CST [99159] LOG:  checkpoint starting: time
2025-03-25 00:01:03.788 CST [99159] LOG:  checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.925 s, sync=0.016 s, total=1.980 s; sync files=17, longest=0.008 s, average=0.001 s; distance=70 kB, estimate=70 kB
2025-03-25 00:05:00.038 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-25 00:05:00.038 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_chat_log, 2025-03-24 16:05:00+00) already exists.
2025-03-25 00:05:00.038 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-25T00:05:00+08:00'::timestamptz, 0.0169100000000000, 1742832300.01691, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-25 00:06:01.849 CST [99159] LOG:  checkpoint starting: time
2025-03-25 00:06:03.506 CST [99159] LOG:  checkpoint complete: wrote 18 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.559 s, sync=0.041 s, total=1.657 s; sync files=14, longest=0.014 s, average=0.003 s; distance=40 kB, estimate=67 kB
2025-03-25 02:00:00.024 CST [99174] ERROR:  duplicate key value violates unique constraint "unique_job_executions"
2025-03-25 02:00:00.024 CST [99174] DETAIL:  Key (job_id, run_time)=(clean_debug_file, 2025-03-24 18:00:00+00) already exists.
2025-03-25 02:00:00.024 CST [99174] STATEMENT:  INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-25T02:00:00+08:00'::timestamptz, 0.0169350000000000, 1742839200.01694, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-25 02:01:03.455 CST [99159] LOG:  checkpoint starting: time
2025-03-25 02:01:04.694 CST [99159] LOG:  checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.046 s, sync=0.145 s, total=1.240 s; sync files=12, longest=0.066 s, average=0.013 s; distance=26 kB, estimate=63 kB
2025-03-25 15:31:16.943 CST [99159] LOG:  checkpoint starting: time
2025-03-25 15:31:28.366 CST [99159] LOG:  checkpoint complete: wrote 114 buffers (0.7%); 0 WAL file(s) added, 0 removed, 0 recycled; write=11.336 s, sync=0.038 s, total=11.424 s; sync files=43, longest=0.013 s, average=0.001 s; distance=661 kB, estimate=661 kB
2025-03-25 15:36:16.376 CST [99159] LOG:  checkpoint starting: time
2025-03-25 15:36:17.555 CST [99159] LOG:  checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.110 s, sync=0.012 s, total=1.180 s; sync files=12, longest=0.003 s, average=0.001 s; distance=13 kB, estimate=596 kB
2025-03-25 15:41:16.655 CST [99159] LOG:  checkpoint starting: time
2025-03-25 15:41:18.978 CST [99159] LOG:  checkpoint complete: wrote 21 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.092 s, sync=0.077 s, total=2.324 s; sync files=16, longest=0.047 s, average=0.005 s; distance=10 kB, estimate=537 kB

Additional Information

No response

@shaohuzhang1
Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Contact Information

1754860514@qq.com

MaxKB Version

1.10.1, maxkb-v1.10.1-lts-offline

Problem Description

After docker runs the maxkb container, the image started on that day will automatically restart in a few days. I don’t know why.

Sometimes when I restart, I still can't access the web page, so I went online to find relevant methods:
https://blog.csdn.net/m0_59704905/article/details/145626973
https://bbs.fit2cloud.com/t/topic/8690

Reference steps:

  1. docker start maxkb
  2. docker exec -it maxkb bash
  3. python main.py dev celery
  4. Visit http://192.168.0.147:8880/ui/login

Then you can access it, and then you can access it.

A new problem will appear later: I don’t know if it is because the log below reports an error message or something else. I am currently visiting http://192.168.0.147:8880/ui/login for conversation. It is very slow. When I am using the application-selecting an application-setting interface, I often return Sorry, it is currently under maintenance and cannot provide services. Please try again later! Messages like are returned.

Is there any solution? I know that ERROR: duplicate key value violates unique constraint "unique_job_executions" is because postgresql reports an error, but I don't know how to solve it? Has anyone encountered the same problem? Will this error cause my final request to slow down?
Will return Sorry, it is currently under maintenance and cannot provide service. Please try again later! Is this kind of information?

Steps to Reproduce

  1. docker run -d
    --name=maxkb
    --publish 8880:8080
    --volume ./maxkb/data:/var/lib/postgresql/data
    --volume ./maxkb/model:/opt/maxkb/model/embedding
    docker.1panel.live/1panel/maxkb
  2. docker exec -it maxkb bash
  3. python main.py dev celery
  4. When accessing the web page appears, you will find the application-dialogue, which will cause this problem.

The expected correct result

No response

Related log output

2025-03-19 00:00:00.311 CST [99164] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 00:00:00.311 CST [99164] DETAIL: Key (job_id, run_time)=(access_num_reset, 2025-03-18 16:00:00+00) already exists.
2025-03-19 00:00:00.311 CST [99164] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-19T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 00:00:00.311 CST [99165] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 00:00:00.311 CST [99165] DETAIL: Key (job_id, run_time)=(access_num_reset, 2025-03-18 16:00:00+00) already exists.
2025-03-19 00:00:00.311 CST [99165] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-19T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 00:03:38.333 CST [99159] LOG: checkpoint starting: time
2025-03-19 00:03:39.694 CST [99159] LOG: checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.271 s, sync=0.019 s, total=1.361 s; sync files=13, longest=0.008 s, average=0.002 s; distance=32 kB, estimate=35 kB
2025-03-19 00:08:38.739 CST [99159] LOG: checkpoint starting: time
2025-03-19 00:08:39.877 CST [99159] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.037 s, sync=0.025 s, total=1.138 s; sync files=12, longest=0.016 s, average=0.003 s; distance=19 kB, estimate=33 kB
2025-03-19 02:00:00.024 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-19 02:00:00.024 CST [99174] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-18 18:00:00+00) already exists.
2025-03-19 02:00:00.024 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-19T02:00:00+08:00'::timestamptz, 0.015536000000000, 1742320800.01554, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-19 02:03:40.780 CST [99159] LOG: checkpoint starting: time
2025-03-19 02:03:41.874 CST [99159] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.022 s, sync=0.026 s, total=1.095 s; sync files=12, longest=0.017 s, average=0.003 s; distance=25 kB, estimate=33 kB
2025-03-20 00:00:00.443 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:00:00.443 CST [99174] DETAIL: Key (job_id, run_time)=(access_num_reset, 2025-03-19 16:00:00+00) already exists.
2025-03-20 00:00:00.443 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Executed', '2025-03-20T00:00:00+08:00'::timestamptz, 0.41281000000000, 17424000000.41281, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:00:00.443 CST [99164] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:00:00.443 CST [99164] DETAIL: Key (job_id, run_time)=(access_num_reset, 2025-03-19 16:00:00+00) already exists.
2025-03-20 00:00:00.443 CST [99164] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-20T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:04:03.123 CST [99159] LOG: checkpoint starting: time
2025-03-20 00:04:05.182 CST [99159] LOG: checkpoint complete: wrote 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.936 s, sync=0.044 s, total=2.041 s; sync files=17, longest=0.024 s, average=0.003 s; distance=35 kB, estimate=35 kB
2025-03-20 00:05:00.026 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 00:05:00.026 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-19 16:05:00+00) already exists.
2025-03-20 00:05:00.026 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-20T00:05:00+08:00'::timestamptz, 0.019253000000000, 1742400300.01925, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 00:09:03.208 CST [99159] LOG: checkpoint starting: time
2025-03-20 00:09:04.426 CST [99159] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.082 s, sync=0.033 s, total=1.218 s; sync files=12, longest=0.017 s, average=0.003 s; distance=24 kB, estimate=34 kB
2025-03-20 02:00:00.035 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-20 02:00:00.035 CST [99174] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-19 18:00:00+00) already exists.
2025-03-20 02:00:00.035 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-20T02:00:00+08:00'::timestamptz, 0.027388000000000, 1742407200.02739, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-20 02:04:05.230 CST [99159] LOG: checkpoint starting: time
2025-03-20 02:04:07.043 CST [99159] LOG: checkpoint complete: wrote 20 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.723 s, sync=0.028 s, total=1.814 s; sync files=16, longest=0.005 s, average=0.002 s; distance=52 kB, estimate=52 kB
2025-03-21 00:00:00.067 CST [99165] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-21 00:00:00.067 CST [99165] DETAIL: Key (job_id, run_time)=(access_num_reset, 2025-03-20 16:00:00+00) already exists.
2025-03-21 00:00:00.067 CST [99165] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('access_num_reset', 'Started execution', '2025-03-21T00:00:00+08:00'::timestamptz, NULL, NULL, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-21 00:04:27.321 CST [99159] LOG: checkpoint starting: time
2025-03-21 00:04:29.054 CST [99159] LOG: checkpoint complete: wrote 19 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.627 s, sync=0.041 s, total=1.734 s; sync files=16, longest=0.026 s, average=0.003 s; distance=50 kB, estimate=52 kB
2025-03-21 00:05:00.021 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-21 00:05:00.021 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-20 16:05:00+00) already exists.
2025-03-21 00:05:00.021 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-21T00:05:00+08:00'::timestamptz, 0.0161870000000000, 1742486700.01619, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-21 00:09:27.154 CST [99159] LOG: checkpoint starting: time
2025-03-21 00:09:28.729 CST [99159] LOG: checkpoint complete: wrote 17 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.425 s, sync=0.027 s, total=1.575 s; sync files=14, longest=0.016 s, average=0.002 s; distance=25 kB, estimate=49 kB
2025-03-21 02:04:29.219 CST [99159] LOG: checkpoint starting: time
2025-03-21 02:04:30.394 CST [99159] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.120 s, sync=0.025 s, total=1.175 s; sync files=13, longest=0.018 s, average=0.002 s; distance=19 kB, estimate=46 kB
2025-03-22 00:04:51.511 CST [99159] LOG: checkpoint starting: time
2025-03-22 00:04:52.818 CST [99159] LOG: checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.221 s, sync=0.036 s, total=1.308 s; sync files=13, longest=0.018 s, average=0.003 s; distance=34 kB, estimate=45 kB
2025-03-22 00:05:00.031 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-22 00:05:00.031 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-21 16:05:00+00) already exists.
2025-03-22 00:05:00.031 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-22T00:05:00+08:00'::timestamptz, 0.0189400000000000, 1742573100.01894, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-22 00:09:51.917 CST [99159] LOG: checkpoint starting: time
2025-03-22 00:09:53.080 CST [99159] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.037 s, sync=0.061 s, total=1.163 s; sync files=12, longest=0.028 s, average=0.006 s; distance=24 kB, estimate=43 kB
2025-03-22 02:00:00.033 CST [99172] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-22 02:00:00.033 CST [99172] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-21 18:00:00+00) already exists.
2025-03-22 02:00:00.033 CST [99172] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-22T02:00:00+08:00'::timestamptz, 0.023867000000000, 1742580000.02387, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-22 02:04:52.612 CST [99159] LOG: checkpoint starting: time
2025-03-22 02:04:53.615 CST [99159] LOG: checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.929 s, sync=0.018 s, total=1.004 s; sync files=12, longest=0.008 s, average=0.002 s; distance=25 kB, estimate=41 kB
2025-03-23 ​​00:00:13.871 CST [99159] LOG: checkpoint starting: time
2025-03-23 ​​00:00:15.268 CST [99159] LOG: checkpoint complete: wrote 16 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.326 s, sync=0.037 s, total=1.397 s; sync files=14, longest=0.012 s, average=0.003 s; distance=28 kB, estimate=40 kB
2025-03-23 ​​00:05:00.036 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-23 ​​00:05:00.036 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-22 16:05:00+00) already exists.
2025-03-23 ​​00:05:00.036 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-23T00:05:00+08:00'::timestamptz, 0.0220040000000000, 1742659500.02200, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-23 ​​00:05:13.304 CST [99159] LOG: checkpoint starting: time
2025-03-23 ​​00:05:14.792 CST [99159] LOG: checkpoint complete: wrote 17 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.430 s, sync=0.017 s, total=1.489 s; sync files=15, longest=0.011 s, average=0.002 s; distance=39 kB, estimate=40 kB
2025-03-23 ​​02:00:00.028 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-23 ​​02:00:00.028 CST [99174] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-22 18:00:00+00) already exists.
2025-03-23 ​​02:00:00.028 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-23T02:00:00+08:00'::timestamptz, 0.020384000000000, 1742666400.02038, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-23 ​​02:00:15.719 CST [99159] LOG: checkpoint starting: time
2025-03-23 ​​02:00:16.973 CST [99159] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.127 s, sync=0.059 s, total=1.255 s; sync files=12, longest=0.025 s, average=0.005 s; distance=26 kB, estimate=38 kB
2025-03-24 00:00:37.127 CST [99159] LOG: checkpoint starting: time
2025-03-24 00:00:38.410 CST [99159] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.144 s, sync=0.052 s, total=1.284 s; sync files=13, longest=0.033 s, average=0.004 s; distance=27 kB, estimate=37 kB
2025-03-24 00:05:00.025 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-24 00:05:00.025 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-23 ​​16:05:00+00) already exists.
2025-03-24 00:05:00.025 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-24T00:05:00+08:00'::timestamptz, 0.0183500000000000, 1742745900.01835, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-24 00:05:37.455 CST [99159] LOG: checkpoint starting: time
2025-03-24 00:05:38.796 CST [99159] LOG: checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.241 s, sync=0.021 s, total=1.341 s; sync files=14, longest=0.009 s, average=0.002 s; distance=42 kB, estimate=42 kB
2025-03-24 02:00:00.021 CST [99172] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-24 02:00:00.021 CST [99172] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-23 ​​18:00:00+00) already exists.
2025-03-24 02:00:00.021 CST [99172] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-24T02:00:00+08:00'::timestamptz, 0.012943000000000, 1742752800.01294, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-24 02:00:39.683 CST [99159] LOG: checkpoint starting: time
2025-03-24 02:00:40.851 CST [99159] LOG: checkpoint complete: wrote 14 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.121 s, sync=0.016 s, total=1.169 s; sync files=13, longest=0.010 s, average=0.002 s; distance=29 kB, estimate=41 kB
2025-03-25 00:01:01.809 CST [99159] LOG: checkpoint starting: time
2025-03-25 00:01:03.788 CST [99159] LOG: checkpoint complete: write 22 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.925 s, sync=0.016 s, total=1.980 s; sync files=17, longest=0.008 s, average=0.001 s; distance=70 kB, estimate=70 kB
2025-03-25 00:05:00.038 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-25 00:05:00.038 CST [99174] DETAIL: Key (job_id, run_time)=(clean_chat_log, 2025-03-24 16:05:00+00) already exists.
2025-03-25 00:05:00.038 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_chat_log', 'Executed', '2025-03-25T00:05:00+08:00'::timestamptz, 0.0169100000000000, 1742832300.01691, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-25 00:06:01.849 CST [99159] LOG: checkpoint starting: time
2025-03-25 00:06:03.506 CST [99159] LOG: checkpoint complete: wrote 18 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.559 s, sync=0.041 s, total=1.657 s; sync files=14, longest=0.014 s, average=0.003 s; distance=40 kB, estimate=67 kB
2025-03-25 02:00:00.024 CST [99174] ERROR: duplicate key value violates unique constraint "unique_job_executions"
2025-03-25 02:00:00.024 CST [99174] DETAIL: Key (job_id, run_time)=(clean_debug_file, 2025-03-24 18:00:00+00) already exists.
2025-03-25 02:00:00.024 CST [99174] STATEMENT: INSERT INTO "django_apscheduler_djangojobexecution" ("job_id", "status", "run_time", "duration", "finished", "exception", "traceback") VALUES ('clean_debug_file', 'Executed', '2025-03-25T02:00:00+08:00'::timestamptz, 0.016935000000000, 1742839200.01694, NULL, NULL) RETURNING "django_apscheduler_djangojobexecution"."id"
2025-03-25 02:01:03.455 CST [99159] LOG: checkpoint starting: time
2025-03-25 02:01:04.694 CST [99159] LOG: checkpoint complete: wrote 13 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.046 s, sync=0.145 s, total=1.240 s; sync files=12, longest=0.066 s, average=0.013 s; distance=26 kB, estimate=63 kB
2025-03-25 15:31:16.943 CST [99159] LOG: checkpoint starting: time
2025-03-25 15:31:28.366 CST [99159] LOG: checkpoint complete: write 114 buffers (0.7%); 0 WAL file(s) added, 0 removed, 0 recycled; write=11.336 s, sync=0.038 s, total=11.424 s; sync files=43, longest=0.013 s, average=0.001 s; distance=661 kB, estimate=661 kB
2025-03-25 15:36:16.376 CST [99159] LOG: checkpoint starting: time
2025-03-25 15:36:17.555 CST [99159] LOG: checkpoint complete: wrote 12 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.110 s, sync=0.012 s, total=1.180 s; sync files=12, longest=0.003 s, average=0.001 s; distance=13 kB, estimate=596 kB
2025-03-25 15:41:16.655 CST [99159] LOG: checkpoint starting: time
2025-03-25 15:41:18.978 CST [99159] LOG: checkpoint complete: wrote 21 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=2.092 s, sync=0.077 s, total=2.324 s; sync files=16, longest=0.047 s, average=0.005 s; distance=10 kB, estimate=537 kB

Additional Information

No response

@shaohuzhang1 shaohuzhang1 changed the title [Bug] ERROR: duplicate key value violates unique constraint "unique_job_executions" [Bug] ERROR: duplicate key value violates unique constraint "unique_job_executions" Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants