This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Commit 48dcf87
committed
VmContext.loop: Hold ctx.lock when access ctx.handler to fix crash
Got following crash in hyperd:
E0409 03:06:59.520358 30295 json.go:458] SB[vm-QctatzSfUb] tty socket closed, quit the the reading goroutine: read unix @->/var/run/hyper/vm-QctatzSfUb/tty.sock: use of closed
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x93c26a]
goroutine 33274 [running]:
github.com/hyperhq/hyperd/vendor/github.com/hyperhq/runv/hypervisor.(*VmContext).loop(0xc42171eb00)
/root/gopath/src/github.com/hyperhq/hyperd/vendor/github.com/hyperhq/runv/hypervisor/hypervisor.go:24 +0x20a
created by github.com/hyperhq/hyperd/vendor/github.com/hyperhq/runv/hypervisor.(*VmContext).Launch
/root/gopath/src/github.com/hyperhq/hyperd/vendor/github.com/hyperhq/runv/hypervisor/hypervisor.go:92
The root cause is VmContext.loop access ctx.handler without lock.
Add code hold ctx.lock to handle the issue.
Signed-off-by: Hui Zhu <teawater@hyper.sh>1 parent acc162c commit 48dcf87
1 file changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
24 | | - | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| |||
0 commit comments