proc: fix hang caused by g.atomicstatus has change to atomic.Uint32 (#3129)

Co-authored-by: weixiecui <weixiecui@futunn.com>
This commit is contained in:
cui
2022-09-21 02:54:56 +08:00
committed by GitHub
parent 0fedc08b90
commit 5ebf020be9
2 changed files with 16 additions and 2 deletions

View File

@ -27,7 +27,7 @@ type g struct {
waitsince int64
waitreason waitReason (optional)
stack stack
atomicstatus uint32
atomicstatus anytype
}
type gobuf struct {

View File

@ -918,7 +918,21 @@ func (v *Variable) parseG() (*G, error) {
}
}
status := loadInt64Maybe("atomicstatus") // +rtype uint32
status := uint64(0)
if atomicStatus := v.loadFieldNamed("atomicstatus"); atomicStatus != nil {
if constant.Val(atomicStatus.Value) != nil {
status, _ = constant.Uint64Val(atomicStatus.Value)
} else {
vv := atomicStatus.fieldVariable("value")
if vv == nil {
unreadable = true
} else {
status, _ = constant.Uint64Val(vv.Value)
}
}
} else {
unreadable = true
}
if unreadable {
return nil, ErrUnreadableG