Skip to content

[Bug] Docker container will always restart if it executes operations involving databases. #2361

@Gwen0x4c3

Description

@Gwen0x4c3

Contact Information

932713272@qq.com

MaxKB Version

v1.10.1-lts

Problem Description

登录、修改密码、添加模型、创建应用等涉及到数据库,docker 容器就会重启
我在使用 macbook pro m3,macos sonoma 14.6
由于公司不让用 docker desktop,只能通过 colima 使用 docker

apps/common/util/function_code.py这里的问题吗,我看里面有个 chown

Steps to Reproduce

正常启动
docker run -d --name=maxkb --restart=always -p 8080:8080 -v ~/maxkb/.maxkb:/var/lib/postgresql/data -v ~/maxkb/.python-packages:/opt/maxkb/app/sandbox/python-packages 1panel/maxkb

The expected correct result

No response

Related log output

### docker logs maxkb

Apply all migrations: application, contenttypes, dataset, django_apscheduler, django_celery_beat, embedding, function_lib, setting, users
Running migrations:
  No migrations to apply.
  Your models in app(s): 'dataset', 'function_lib' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

- Start Gunicorn WSGI HTTP Server

- Start Celery as Distributed Task Queue: Celery

- Start Gunicorn Local Model WSGI HTTP Server
2025-02-24 14:18:28 Check service status: gunicorn -> running at 41
2025-02-24 14:18:29 Check service status: celery_default -> running at 42
2025-02-24 14:18:30 Check service status: local_model -> running at 43
2025-02-24 14:19:01 Check service status: gunicorn -> running at 41
2025-02-24 14:19:02 Check service status: celery_default -> stopped at 42
Stop service: gunicorn Error
celery_default is stopped.
Stop service: local_model Ok

PostgreSQL Database directory appears to contain a database; Skipping initialization

2025-02-24 14:19:05.541 CST [8] LOG:  starting PostgreSQL 15.8 (Debian 15.8-1.pgdg110+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2025-02-24 14:19:05.541 CST [8] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2025-02-24 14:19:05.541 CST [8] LOG:  listening on IPv6 address "::", port 5432
2025-02-24 14:19:05.548 CST [8] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-02-24 14:19:05.575 CST [32] LOG:  database system was interrupted; last known up at 2025-02-24 14:18:17 CST
2025-02-24 14:19:06.794 CST [32] LOG:  database system was not properly shut down; automatic recovery in progress
2025-02-24 14:19:06.814 CST [32] LOG:  redo starts at 0/21B55C8
2025-02-24 14:19:06.819 CST [32] LOG:  invalid record length at 0/21B8D18: wanted 24, got 0
2025-02-24 14:19:06.819 CST [32] LOG:  redo done at 0/21B8CE0 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
2025-02-24 14:19:06.839 CST [30] LOG:  checkpoint starting: end-of-recovery immediate wait
2025-02-24 14:19:06.873 CST [30] LOG:  checkpoint complete: wrote 7 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.008 s, sync=0.022 s, total=0.036 s; sync files=6, longest=0.019 s, average=0.004 s; distance=13 kB, estimate=13 kB
2025-02-24 14:19:06.880 CST [8] LOG:  database system is ready to accept connections
127.0.0.1:5432 - accepting connections
Building prefix dict from the default dictionary ...
DEBUG:jieba:Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
DEBUG:jieba:Loading model from cache /tmp/jieba.cache
Loading model cost 0.315 seconds.
DEBUG:jieba:Loading model cost 0.315 seconds.
Prefix dict has been built successfully.
DEBUG:jieba:Prefix dict has been built successfully.
Operations to perform:
  Apply all migrations: application, contenttypes, dataset, django_apscheduler, django_celery_beat, embedding, function_lib, setting, users
Running migrations:
  No migrations to apply.
  Your models in app(s): 'dataset', 'function_lib' have changes that are not yet reflected in a migration, and so won't be applied.
  Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.

- Start Gunicorn Local Model WSGI HTTP Server

- Start Celery as Distributed Task Queue: Celery

- Start Gunicorn WSGI HTTP Server
2025-02-24 14:19:17 Check service status: local_model -> running at 42
2025-02-24 14:19:18 Check service status: celery_default -> running at 43
2025-02-24 14:19:19 Check service status: gunicorn -> running at 44


### celery_default.log

Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.304 seconds.
Prefix dict has been built successfully.
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
/opt/py3/lib/python3.11/site-packages/celery/platforms.py:829: SecurityWarning: You're running the worker with superuser privileges: this is
absolutely not recommended!

Please specify a different user using the --uid option.

User information: uid=0 euid=0 gid=0 egid=0

  warnings.warn(SecurityWarning(ROOT_DISCOURAGED.format(
 
 -------------- celery@2e92a53f24c9 v5.4.0 (opalescent)
--- ***** ----- 
-- ******* ---- Linux-6.8.0-50-generic-aarch64-with-glibc2.31 2025-02-24 14:34:29
- *** --- * --- 
- ** ---------- [config]
- ** ---------- .> app:         MaxKB:0xe548437d0090
- ** ---------- .> transport:   sqla+sqlite:////opt/maxkb/app/data/celery_task/celery_db.sqlite3
- ** ---------- .> results:     sqlite:////opt/maxkb/app/data/celery_task/celery_results.sqlite3
- *** --- * --- .> concurrency: 10 (thread)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery


### gunicorn.log

ovider&model_type=LLM&model_name=generalv3.5 HTTP/1.1" 200 1197
172.17.0.1 [24/Feb/2025:14:18:57 +0800] 0.011905s "GET /api/model?name=&create_user=&permission_type=&model_type=&provider=model_zhipu_provider HTTP/1.1" 200 52
172.17.0.1 [24/Feb/2025:14:18:58 +0800] 0.003492s "GET /api/provider/model_type_list?provider=model_zhipu_provider HTTP/1.1" 200 217
172.17.0.1 [24/Feb/2025:14:19:00 +0800] 0.006209s "GET /api/provider/model_list?provider=model_zhipu_provider&model_type=IMAGE HTTP/1.1" 200 714
172.17.0.1 [24/Feb/2025:14:19:01 +0800] 0.007950s "GET /api/provider/model_params_form?provider=model_zhipu_provider&model_type=IMAGE&model_name=glm-4v-plus HTTP/1.1" 200 1198
172.17.0.1 [24/Feb/2025:14:19:01 +0800] 0.010330s "GET /api/provider/model_form?provider=model_zhipu_provider&model_type=IMAGE&model_name=glm-4v-plus HTTP/1.1" 200 293
[2025-02-24 14:19:02 +0800] [41] [INFO] Handling signal: term
[2025-02-24 14:19:03 +0800] [44] [INFO] Worker exiting (pid: 44)
[2025-02-24 14:19:16 +0800] [44] [INFO] Starting gunicorn 22.0.0
[2025-02-24 14:19:16 +0800] [44] [INFO] Listening at: http://0.0.0.0:8080 (44)
[2025-02-24 14:19:16 +0800] [44] [INFO] Using worker: gthread
[2025-02-24 14:19:16 +0800] [46] [INFO] Booting worker with pid: 46
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.426 seconds.
Prefix dict has been built successfully.
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
172.17.0.1 [24/Feb/2025:14:19:21 +0800] 2.990781s "GET /api/model?name=&create_user=&permission_type=&model_type=&provider=model_deepseek_provider HTTP/1.1" 200 52
172.17.0.1 [24/Feb/2025:14:19:21 +0800] 2.992157s "GET /api/model?name=&create_user=&permission_type=&model_type=&provider=model_gemini_provider HTTP/1.1" 200 52
172.17.0.1 [24/Feb/2025:14:19:21 +0800] 0.002480s "GET /api/model?name=&create_user=&permission_type=&model_type=&provider=model_deepseek_provider HTTP/1.1" 200 52
172.17.0.1 [24/Feb/2025:14:19:21 +0800] 0.004499s "GET /api/model?name=&create_user=&permission_type=&model_type=&provider=model_gemini_provider HTTP/1.1" 200 52
[2025-02-24 14:19:25 +0800] [44] [ERROR] Worker (pid:46) was sent SIGKILL! Perhaps out of memory?
[2025-02-24 14:19:25 +0800] [84] [INFO] Booting worker with pid: 84
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.304 seconds.
Prefix dict has been built successfully.
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
chown: invalid group: ‘sandbox:sandbox’
172.17.0.1 [24/Feb/2025:14:34:05 +0800] 8.230393s "GET /api/provider/model_type_list?provider=model_deepseek_provider HTTP/1.1" 200 109
[2025-02-24 14:34:10 +0800] [44] [INFO] Handling signal: term
[2025-02-24 14:34:11 +0800] [84] [INFO] Worker exiting (pid: 84)
[2025-02-24 14:34:24 +0800] [42] [INFO] Starting gunicorn 22.0.0
[2025-02-24 14:34:24 +0800] [42] [INFO] Listening at: http://0.0.0.0:8080 (42)
[2025-02-24 14:34:24 +0800] [42] [INFO] Using worker: gthread
[2025-02-24 14:34:24 +0800] [44] [INFO] Booting worker with pid: 44
Building prefix dict from the default dictionary ...
Loading model from cache /tmp/jieba.cache
Loading model cost 0.473 seconds.
Prefix dict has been built successfully.

Additional Information

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions