Bug: upgrading from 0.5.1 to 0.6.1: panic: runtime error: invalid memory address or nil pointer dereference
Describe the bug The worker and crawlab master can keep restarting after the upgrade.
To Reproduce Steps to reproduce the behavior:
- Using 0.5.1 crawlab setup, put the dockers down:
docker-compose down | true
- Pull the most recent image:
docker pull crawlabteam/crawlab
- Edit the docker-composer.yml and replace
tikazyq/crawlab:latest
with
image: crawlabteam/crawlab:latest
- Execute the docker-compose command:
docker-compose up -d
Expected behavior I expect to see the 0.6.1 version running
To Revert
- Execute
docker-compose down | true
- Undo the changes in the step 3
- Execute:
docker-compose up -d
Now v0.5.1 will return.
Logs
both worker and cralab_master keep restarting:
1abff6a82c63 crawlabteam/crawlab "/bin/bash /app/bin/…" 9 minutes ago Restarting (2) 44 seconds ago worker
7489909bd714 crawlabteam/crawlab "/bin/bash /app/bin/…" 9 minutes ago Restarting (2) 42 seconds ago crawlab_master
The worker log:
/go/pkg/mod/github.com/crawlab-team/[email protected]/trace.go:13 github.com/crawlab-team/go-trace.TraceError()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:97 github.com/crawlab-team/crawlab-core/schedule.(*Service).Enable()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:148 github.com/crawlab-team/crawlab-core/schedule.(*Service).update()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:122 github.com/crawlab-team/crawlab-core/schedule.(*Service).Update()
/usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
expected exactly 5 fields, found 6: [0 0 1 * * *]
/go/pkg/mod/github.com/crawlab-team/[email protected]/trace.go:13 github.com/crawlab-team/go-trace.TraceError()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:97 github.com/crawlab-team/crawlab-core/schedule.(*Service).Enable()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:148 github.com/crawlab-team/crawlab-core/schedule.(*Service).update()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:122 github.com/crawlab-team/crawlab-core/schedule.(*Service).Update()
/usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xf1ed32]
goroutine 103 [running]:
github.com/crawlab-team/crawlab-core/models/service.(*Service).GetTaskList(0xc000692280, 0xc000409d70, 0x0, 0x6, 0xc0000c6988, 0x0, 0x4422f6, 0x12d97d0)
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/task_service.go:35 +0x72
github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).initTaskStatus(0xc00040ea80)
/go/pkg/mod/github.com/crawlab-team/[email protected]/task/scheduler/service.go:431 +0xb0
created by github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).Start
/go/pkg/mod/github.com/crawlab-team/[email protected]/task/scheduler/service.go:45 +0x45
crawlab master log:
/go/pkg/mod/github.com/crawlab-team/[email protected]/trace.go:13 github.com/crawlab-team/go-trace.TraceError()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:97 github.com/crawlab-team/crawlab-core/schedule.(*Service).Enable()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:148 github.com/crawlab-team/crawlab-core/schedule.(*Service).update()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:122 github.com/crawlab-team/crawlab-core/schedule.(*Service).Update()
/usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
expected exactly 5 fields, found 6: [0 0 1 * * *]
/go/pkg/mod/github.com/crawlab-team/[email protected]/trace.go:13 github.com/crawlab-team/go-trace.TraceError()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:97 github.com/crawlab-team/crawlab-core/schedule.(*Service).Enable()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:148 github.com/crawlab-team/crawlab-core/schedule.(*Service).update()
/go/pkg/mod/github.com/crawlab-team/[email protected]/schedule/service.go:122 github.com/crawlab-team/crawlab-core/schedule.(*Service).Update()
/usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
error decoding key _id: an ObjectID string must be exactly 12 bytes long (got 36)
/go/pkg/mod/github.com/crawlab-team/[email protected]/trace.go:13 github.com/crawlab-team/go-trace.TraceError()
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/binder_list.go:82 github.com/crawlab-team/crawlab-core/models/service.(*ListBinder).Process()
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/binder_list.go:42 github.com/crawlab-team/crawlab-core/models/service.(*ListBinder).Bind()
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/base_service.go:67 github.com/crawlab-team/crawlab-core/models/service.(*BaseService).GetList()
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/task_service.go:34 github.com/crawlab-team/crawlab-core/models/service.(*Service).GetTaskList()
/go/pkg/mod/github.com/crawlab-team/[email protected]/task/scheduler/service.go:431 github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).initTaskStatus()
/usr/local/go/src/runtime/asm_amd64.s:1371 runtime.goexit()
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xf1ed32]
goroutine 150 [running]:
github.com/crawlab-team/crawlab-core/models/service.(*Service).GetTaskList(0xc000409840, 0xc000e9e000, 0x0, 0x6, 0xc0003c8088, 0x0, 0x4422f6, 0x12d97d0)
/go/pkg/mod/github.com/crawlab-team/[email protected]/models/service/task_service.go:35 +0x72
github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).initTaskStatus(0xc000392420)
/go/pkg/mod/github.com/crawlab-team/[email protected]/task/scheduler/service.go:431 +0xb0
created by github.com/crawlab-team/crawlab-core/task/scheduler.(*Service).Start
/go/pkg/mod/github.com/crawlab-team/[email protected]/task/scheduler/service.go:45 +0x45
the docker-composer.yml lines about worker and crawlab master:
version: '3.3'
services:
master:
restart: always
image: crawlabteam/crawlab:latest
#image: tikazyq/crawlab:latest
container_name: crawlab_master
environment:
CRAWLAB_SERVER_MASTER: Y
CRAWLAB_MONGO_HOST: mongo
CRAWLAB_REDIS_ADDRESS: "redis"
ports:
- "8080:8080" # frontend port mapping 前端端口映射
depends_on:
- mongo
volumes:
- "./volumes/log/master:/var/logs/crawlab"
- "./volumes/spiders:/app/spiders"
worker:
restart: always
image: crawlabteam/crawlab:latest
#image: tikazyq/crawlab:latest
container_name: worker
environment:
CRAWLAB_SERVER_MASTER: "N"
CRAWLAB_MONGO_HOST: "mongo"
CRAWLAB_REDIS_ADDRESS: "redis"
depends_on:
- mongo
volumes:
- "./volumes/log/worker:/var/logs/crawlab" # log persistent 日志持久化
Please refer to the documentation for v0.6
https://docs.crawlab.cn/en/guide/installation/docker.html
Please refer to the documentation for v0.6
I did. The steps are the same of the old doc.
Is something special needed to do the ugprade from 0.5.1 to 0.6.x?
Please refer to the documentation for v0.6
I did. The steps are the same of the old doc.
Is something special needed to do the ugprade from 0.5.1 to 0.6.x?
Yes. v0.6 is quite different than 0.5, so as the configuration docker-compose.yml.
In your docker-compose.yml, I can see it's pretty much the same as the one in 0.5. It should be something like this...
version: '3.3'
services:
master:
image: crawlabteam/crawlab
container_name: crawlab_master
restart: always
environment:
CRAWLAB_NODE_MASTER: "Y" # Y: master node
CRAWLAB_MONGO_HOST: "mongo" # mongo host address. In the docker compose network, directly refer to the service name
CRAWLAB_MONGO_PORT: "27017" # mongo port
CRAWLAB_MONGO_DB: "crawlab" # mongo database
CRAWLAB_MONGO_USERNAME: "username" # mongo username
CRAWLAB_MONGO_PASSWORD: "password" # mongo password
CRAWLAB_MONGO_AUTHSOURCE: "admin" # mongo auth source
volumes:
- "/opt/crawlab/master:/data" # persistent crawlab data
ports:
- "8080:8080" # exposed api port
depends_on:
- mongo
mongo:
image: mongo:4.2
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: "username" # mongo username
MONGO_INITDB_ROOT_PASSWORD: "password" # mongo password
volumes:
- "/opt/crawlab/mongo/data/db:/data/db" # persistent mongo data
ports:
- "27017:27017" # expose mongo port to host machine
Understood. I tried to move out the worker and changed the docker-compose.yml to be similar with standard 0.6.x composer file. But I got the same error. So I think is not possible to migrate from 0.5 to 0.6 in most of the cases (maybe due plugins?).
Can you elaborate a little bit more on the issue details?
@tikazyq I followed docker-compose.yml in guide. But I just got this bug with v0.6.0-1. Pls reopen this issue.