Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/go/analysis/passes/httpresponse: unrecognized failures #59910

Closed
gopherbot opened this issue May 1, 2023 · 6 comments
Closed

x/tools/go/analysis/passes/httpresponse: unrecognized failures #59910

gopherbot opened this issue May 1, 2023 · 6 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@gopherbot
Copy link

#!watchflakes
post <- pkg == "golang.org/x/tools/go/analysis/passes/httpresponse" && test == ""

Issue created automatically to collect these failures.

Example (log):

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x5 pc=0x18354]

goroutine 119 [running]:
go/types.(*Checker).handleBailout(0xc0002f7e00, 0xc000115b40)
	/workdir/go/src/go/types/check.go:335 +0xc0
panic({0x2ac2c0?, 0x4c4300?})
	/workdir/go/src/runtime/panic.go:914 +0x27c
go/types.(*Scope).Lookup(...)
...
sync.(*Once).doSlow(0x0?, 0x0?)
	/workdir/go/src/sync/once.go:74 +0x110
sync.(*Once).Do(...)
	/workdir/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:839 +0x80
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:846 +0x40
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 114
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:845 +0x98

watchflakes

@gopherbot gopherbot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 1, 2023
@gopherbot
Copy link
Author

Found new dashboard test flakes for:

#!watchflakes
post <- pkg == "golang.org/x/tools/go/analysis/passes/httpresponse" && test == ""
2023-05-01 14:33 linux-ppc64le-buildlet tools@7590fe4d go@069f9fb2 x/tools/go/analysis/passes/httpresponse (log)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x5 pc=0x18354]

goroutine 119 [running]:
go/types.(*Checker).handleBailout(0xc0002f7e00, 0xc000115b40)
	/workdir/go/src/go/types/check.go:335 +0xc0
panic({0x2ac2c0?, 0x4c4300?})
	/workdir/go/src/runtime/panic.go:914 +0x27c
go/types.(*Scope).Lookup(...)
...
sync.(*Once).doSlow(0x0?, 0x0?)
	/workdir/go/src/sync/once.go:74 +0x110
sync.(*Once).Do(...)
	/workdir/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:839 +0x80
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:846 +0x40
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 114
	/workdir/gopath/src/golang.org/x/tools/go/packages/packages.go:845 +0x98

watchflakes

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 1, 2023
@gopherbot gopherbot added this to the Unreleased milestone May 1, 2023
@timothy-king
Copy link
Contributor

@griesemer @findleyr This looks like a go/types flake.

@findleyr
Copy link
Contributor

findleyr commented May 1, 2023

This panic indicates that check.scope is nil during type-checking... not sure how that is possible.

@findleyr findleyr modified the milestones: Unreleased, Go1.21 May 1, 2023
@adonovan
Copy link
Member

adonovan commented May 3, 2023

I agree, it is weird. The crash is reported in Lookup, whose only (noninlined) possible nil panic is the s dereference, but the call stack shows the parent is LookupParent, which only calls it with a non-nil s.

goroot/src/go/types/scope.go:

// Lookup returns the object in scope s with the given name if such an
// object exists; otherwise the result is nil.
func (s *Scope) Lookup(name string) Object {
	return resolve(name, s.elems[name]) // panic: nil deref here
}

// LookupParent follows the parent chain of scopes starting with s until
// it finds a scope where Lookup(name) returns a non-nil object, and then
// returns that scope and object. If a valid position pos is provided,
// only objects that were declared at or before pos are considered.
// If no such scope and object exists, the result is (nil, nil).
//
// Note that obj.Parent() may be different from the returned scope if the
// object was inserted into the scope and already had a parent at that
// time (see Insert). This can only happen for dot-imported objects
// whose scope is the scope of the package that exported them.
func (s *Scope) LookupParent(name string, pos token.Pos) (*Scope, Object) {
	for ; s != nil; s = s.parent {
		if obj := s.Lookup(name); obj != nil && (!pos.IsValid() || cmpPos(obj.scopePos(), pos) <= 0) { // Lookup called here
			return s, obj
		}
	}
	return nil, nil
}

The ppc assembly looks fine to me. Perhaps one of the compiler+runtime folks can take a look.

TEXT go/types.(*Scope).LookupParent(SB) /Users/adonovan/w/goroot/src/go/types/scope.go
prolog:
  scope.go:86           0x2ada90                eade0010                MOVD 16(R30),R22                        
  scope.go:86           0x2ada94                7c360840                CMPU R22,R1                             
  scope.go:86           0x2ada98                41800030                BLT 0x2adac8    body  

stack check:                      
  scope.go:86           0x2ada9c                f8610020                MOVD R3,32(R1)                          
  scope.go:86           0x2adaa0                f8810028                MOVD R4,40(R1)                          
  scope.go:86           0x2adaa4                f8a10030                MOVD R5,48(R1)                          
  scope.go:86           0x2adaa8                f8c10038                MOVD R6,56(R1)                          
  scope.go:86           0x2adaac                7ca802a6                MOVD LR,R5                              
  scope.go:86           0x2adab0                4bdd3f01                CALL runtime.morestack_noctxt.abi0(SB)  
  scope.go:86           0x2adab4                e8610020                MOVD 32(R1),R3                          
  scope.go:86           0x2adab8                e8810028                MOVD 40(R1),R4                          
  scope.go:86           0x2adabc                e8a10030                MOVD 48(R1),R5                          
  scope.go:86           0x2adac0                e8c10038                MOVD 56(R1),R6                          
  scope.go:86           0x2adac4                4bffffcc                BR go/types.(*Scope).LookupParent(SB)   

body (loop header):   r3=s
  scope.go:86           0x2adac8                7fe802a6                MOVD LR,R31                             
  scope.go:86           0x2adacc                fbe1ffa9                MOVDU R31,-88(R1)                       
  scope.go:86           0x2adad0                f8c10090                MOVD R6,144(R1)                         
  scope.go:86           0x2adad4                f8a10088                MOVD R5,136(R1)                         
  scope.go:86           0x2adad8                f8810080                MOVD R4,128(R1)                         
  scope.go:87           0x2adadc                48000018                BR 0x2adaf4  looptest
loophead:                           
  scope.go:87           0x2adae0                e9010050                MOVD 80(R1),R8                          
  scope.go:87           0x2adae4                e8680000                MOVD 0(R8),R3   load s indirectly from stack
  scope.go:73           0x2adae8                e8810080                MOVD 128(R1),R4                         
  scope.go:73           0x2adaec                e8a10088                MOVD 136(R1),R5                         
  position.go:88        0x2adaf0                7ce63b78                OR R7,R7,R6                             
looptest:
  scope.go:87           0x2adaf4                7c230000                CMP R3,R0                               
  scope.go:87           0x2adaf8                418200bc                BEQ 0x2adbb4      if s == nil return
  scope.go:87           0x2adafc                f8610050                MOVD R3,80(R1)       spill s  
# --- this is the range of lines reported in the crash ---             
  scope.go:73           0x2adb00                e8e30028                MOVD 40(R3),R7     s.elems                      
  scope.go:73           0x2adb04                7ca62b78                OR R5,R5,R6                        
  scope.go:73           0x2adb08                7c852378                OR R4,R4,R5                             
  scope.go:73           0x2adb0c                7ce43b78                OR R7,R7,R4                             
  scope.go:73           0x2adb10                3c600094                ADDIS $0,$148,R3                        
  scope.go:73           0x2adb14                38633020                ADD R3,$12320,R3                        
  scope.go:73           0x2adb18                4bd74429                CALL runtime.mapaccess1_faststr(SB)     
  scope.go:73           0x2adb1c                e8a30000                MOVD 0(R3),R5                   
  scope.go:73           0x2adb20                e8c30008                MOVD 8(R3),R6                           
  scope.go:73           0x2adb24                e8610080                MOVD 128(R1),R3   unspill s                       
  scope.go:73           0x2adb28                e8810088                MOVD 136(R1),R4                         
  scope.go:73           0x2adb2c                48000ab5                CALL go/types.resolve(SB)               
# ---
  ...

@findleyr
Copy link
Contributor

findleyr commented May 3, 2023

CC @golang/runtime

@bcmills
Copy link
Contributor

bcmills commented May 3, 2023

Duplicate of #37602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
Status: Done
Development

No branches or pull requests

5 participants