This repository was archived by the owner on Feb 8, 2021. It is now read-only.
VmContext.loop: Hold ctx.lock when access ctx.handler to fix crash #681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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