summaryrefslogtreecommitdiff
path: root/src/runtime/chan.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/chan.go')
-rw-r--r--src/runtime/chan.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime/chan.go b/src/runtime/chan.go
index a4ee51ca39..5cf0b86f58 100644
--- a/src/runtime/chan.go
+++ b/src/runtime/chan.go
@@ -232,6 +232,11 @@ func chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool {
gp.param = nil
c.sendq.enqueue(mysg)
goparkunlock(&c.lock, waitReasonChanSend, traceEvGoBlockSend, 3)
+ // Ensure the value being sent is kept alive until the
+ // receiver copies it out. The sudog has a pointer to the
+ // stack object, but sudogs aren't considered as roots of the
+ // stack tracer.
+ KeepAlive(ep)
// someone woke us up.
if mysg != gp.waiting {