runtime error: invalid memory address or nil pointer dereference #1468
Replies: 6 comments
-
And my job disappeared from dKron, too. How can I recover the job and dKron. |
Beta Was this translation helpful? Give feedback.
-
I saw this error when I restarted Dkron. time="2023-09-20T16:45:28+08:00" level=info msg="No valid config found: Applying default values." error="Config File \"dkron\" Not Found in \"[/etc/dkron /root/.dkron /opt/dkron/config]\""
2023/09/20 16:45:31 [Recovery] 2023/09/20 - 16:45:31 panic recovered:
runtime error: invalid memory address or nil pointer dereference
/usr/local/go/src/runtime/panic.go:220 (0x44cb55)
/usr/local/go/src/runtime/signal_unix.go:818 (0x44cb25)
/go/pkg/mod/github.com/hashicorp/[email protected]/api.go:769 (0xa5b65d)
/go/src/github.com/distribworks/dkron/dkron/agent.go:624 (0x1aa160b)
/go/src/github.com/distribworks/dkron/dkron/api.go:445 (0x1aa8345)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x1aa5e7e)
/go/src/github.com/distribworks/dkron/dkron/api.go:133 (0x1aa5e65)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x1aa5fb2)
/go/src/github.com/distribworks/dkron/dkron/api.go:139 (0x1aa5f24)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xbe7d61)
/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0xbe7d4c)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xbe6e46)
/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 (0xbe6e29)
/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0xbe5ed0)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0xbe5b38)
/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0xbe567c)
/usr/local/go/src/net/http/server.go:2916 (0x7023ba)
/usr/local/go/src/net/http/server.go:1966 (0x6fd3b6)
/usr/local/go/src/runtime/asm_amd64.s:1571 (0x4675e0)
...
|
Beta Was this translation helpful? Give feedback.
-
If the raft data directory is reset due to pod reconstruction, it won't be possible to recover the task unless you have regular backups.
After reviewing the code, I found that the error happens because Serf did not elect a leader. This issue can arise during the service startup process. If the leader cannot be elected for a long time, there would be something wrong with the configuration or network. |
Beta Was this translation helpful? Give feedback.
-
First of all thanks for your answer. I am using persistent volume, and I do not understand why data is gone or corrupted. Regarding the no leader problem, configuration and infrastructure is same. it always happens when I restart or apply new version. I always cross finger before I restart. I do not know exact problem since it works arbitrarily since configuration is always same and network issue is very unlikely (at least that often, otherwise other services would not work on k8s) |
Beta Was this translation helpful? Give feedback.
-
Could you share the dkron yaml? |
Beta Was this translation helpful? Give feedback.
-
Yes sure. I mount the dkron config files as volume from config map and you can find them below, too.
|
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I have added new volume mounts to k8s configurations and applied them. Afterwards dkron start throwing this error.
P.S. My first try was broken. One of the server was stuck even after I fixed issue and applied again. That's why I evict that pod. Maybe that was related to that.
Logs:
Beta Was this translation helpful? Give feedback.
All reactions