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

s3 panic: runtime error: invalid memory address or nil pointer dereference #1707

Closed
nivekuil opened this issue Dec 28, 2020 · 4 comments
Closed

Comments

@nivekuil
Copy link
Contributor

nivekuil commented Dec 28, 2020

Describe the bug

 http: panic serving 10.0.7.4:59272: runtime error: invalid memory address or nil pointer dereference
goroutine 2101 [running]:
net/http.(*conn).serve.func1(0xc000d88000)
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/net/http/server.go:1801 +0x147
panic(0x1e0a780, 0x33c3f20)
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/runtime/panic.go:975 +0x47a
github.com/chrislusf/seaweedfs/weed/s3api.(*IdentityAccessManagement).authRequest(0xc0006050e0, 0xc000b46e00, 0x216f0df, 0x5, 0xc00039d990, 0x46d69b)
	/home/travis/gopath/src/github.com/chrislusf/seaweedfs/weed/s3api/auth_credentials.go:164 +0x6a
github.com/chrislusf/seaweedfs/weed/s3api.(*IdentityAccessManagement).Auth.func1(0x2552520, 0xc000d05ea0, 0xc000b46e00)
	/home/travis/gopath/src/github.com/chrislusf/seaweedfs/weed/s3api/auth_credentials.go:142 +0x56
github.com/chrislusf/seaweedfs/weed/s3api.track.func1(0x2559da0, 0xc0003fcfc0, 0xc000b46e00)
	/home/travis/gopath/src/github.com/chrislusf/seaweedfs/weed/s3api/stats.go:34 +0x23c
net/http.HandlerFunc.ServeHTTP(0xc0002d4b60, 0x2559da0, 0xc0003fcfc0, 0xc000b46e00)
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/net/http/server.go:2042 +0x44
github.com/gorilla/mux.(*Router).ServeHTTP(0xc00034a000, 0x2559da0, 0xc0003fcfc0, 0xc0007dda00)
	/home/travis/gopath/pkg/mod/github.com/gorilla/mux@v1.7.4/mux.go:210 +0xd3
net/http.serverHandler.ServeHTTP(0xc0008a1b20, 0x2559da0, 0xc0003fcfc0, 0xc0007dda00)
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000d88000, 0x2564520, 0xc0008c7b00)
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
	/home/travis/.gimme/versions/go1.15.6.linux.amd64/src/net/http/server.go:2969 +0x36c

System Setup
515b763 (2.17 Christmas edition)
weed "s3" "-filer=filer:8888" "-metricsPort=9999" "-config=/config.json" "-domainName=s3"
config.json identity has

"actions": [
        "Admin",
        "Read",
        "List",
        "Tagging",
        "Write"
      ]

Expected behavior
A helpful error message

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Using seaweedfs as Cortex block storage which should use signature v4. It seems like this panic happens on every write, while other applications using the same credentials work. It looks like identity here may be nil? https://github.com/chrislusf/seaweedfs/blob/090f85be4b4c02dfd57942e2816dd609b002995d/weed/s3api/auth_credentials.go#L164 (not being familiar with Go, I'm a little surprised that's being evaluated at all when I don't have verbose logging turned on)

@chrislusf
Copy link
Collaborator

what is the content of /config.json? These content in the issue description is not valid at all.

"actions": [
        "Admin",
        "Read",
        "List",
        "Tagging",
        "Write"
      ]

@nivekuil
Copy link
Contributor Author

I figured "actions" was the only relevant part:

{
  "identities": [
    {
      "name": "admin",
      "credentials": [
        {
          "accessKey": "x",
          "secretKey": "x"
        }
      ],
      "actions": [
        "Admin",
        "Read",
        "List",
        "Tagging",
        "Write"
      ]
    },
    {
    "name": "app",
      "credentials": [
        {
          "accessKey": "x",
          "secretKey": "x"
        }
      ],
      "actions": [
        "Read",
        "List",
        "Tagging",
        "Write"
      ]
    }

  ]
}

@chrislusf
Copy link
Collaborator

found the issue. Added a fix.

@nivekuil
Copy link
Contributor Author

nivekuil commented Dec 28, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants