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

Error when attempting to delete a missing bucket #1034

Closed
bentheiii opened this issue Jan 9, 2023 · 1 comment · Fixed by #1035
Closed

Error when attempting to delete a missing bucket #1034

bentheiii opened this issue Jan 9, 2023 · 1 comment · Fixed by #1035
Labels

Comments

@bentheiii
Copy link

When attempting to delete a missing bucket, the server panics:

DELETE https://localhost:4443/storage/v1/b/my_bucket

2023-01-09 10:26:13 2023/01/09 08:26:13 http: panic serving 172.17.0.1:45708: runtime error: invalid memory address or nil pointer dereference
2023-01-09 10:26:13 goroutine 22 [running]:
2023-01-09 10:26:13 net/http.(*conn).serve.func1()
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:1850 +0xbf
2023-01-09 10:26:13 panic({0xabdaa0, 0x112e340})
2023-01-09 10:26:13     /usr/local/go/src/runtime/panic.go:890 +0x262
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/internal/backend.(*storageFS).ListObjects.func1({0xc000038138?, 0x12}, {0x0, 0x0}, {0x13?, 0x2?})
2023-01-09 10:26:13     /code/internal/backend/fs.go:237 +0xca
2023-01-09 10:26:13 path/filepath.Walk({0xc000038138, 0x12}, 0xc00010f0b8)
2023-01-09 10:26:13     /usr/local/go/src/path/filepath/path.go:518 +0x50
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/internal/backend.(*storageFS).ListObjects(0xc00012acc0, {0xc0000aa555, 0x9}, {0x0, 0x0}, 0xba?)
2023-01-09 10:26:13     /code/internal/backend/fs.go:233 +0x1fe
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/internal/backend.(*storageFS).DeleteBucket(0xc00012acc0, {0xc0000aa555, 0x9})
2023-01-09 10:26:13     /code/internal/backend/fs.go:131 +0x65
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/fakestorage.(*Server).deleteBucket(0xc000102d00, 0x17?)
2023-01-09 10:26:13     /code/fakestorage/bucket.go:118 +0x76
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/fakestorage.jsonToHTTPHandler.func1({0xcba270, 0xc000524ba0}, 0xc000216600?)
2023-01-09 10:26:13     /code/fakestorage/json_response.go:24 +0x45
2023-01-09 10:26:13 net/http.HandlerFunc.ServeHTTP(0xc00048c400?, {0xcba270?, 0xc000524ba0?}, 0xcb9160?)
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:2109 +0x2f
2023-01-09 10:26:13 github.com/gorilla/mux.(*Router).ServeHTTP(0xc0003ac480, {0xcba270, 0xc000524ba0}, 0xc00048c300)
2023-01-09 10:26:13     /go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf
2023-01-09 10:26:13 github.com/gorilla/handlers.(*cors).ServeHTTP(0xc0000ecf30, {0xcba270, 0xc000524ba0}, 0xc00048c300)
2023-01-09 10:26:13     /go/pkg/mod/github.com/gorilla/handlers@v1.5.1/cors.go:54 +0x370
2023-01-09 10:26:13 github.com/gorilla/handlers.loggingHandler.ServeHTTP({{0xcb5540, 0xc000386190}, {0xcb3c20, 0xc0000ecf30}, 0xbf3088}, {0xcb9880, 0xc000284000}, 0xc00048c300)
2023-01-09 10:26:13     /go/pkg/mod/github.com/gorilla/handlers@v1.5.1/logging.go:47 +0xef
2023-01-09 10:26:13 github.com/fsouza/fake-gcs-server/fakestorage.requestCompressHandler.func1({0xcb9880, 0xc000284000}, 0xc00048c300)
2023-01-09 10:26:13     /code/fakestorage/server.go:432 +0x116
2023-01-09 10:26:13 net/http.HandlerFunc.ServeHTTP(0x0?, {0xcb9880?, 0xc000284000?}, 0x4648ae?)
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:2109 +0x2f
2023-01-09 10:26:13 net/http.serverHandler.ServeHTTP({0xc000216480?}, {0xcb9880, 0xc000284000}, 0xc00048c300)
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:2947 +0x30c
2023-01-09 10:26:13 net/http.(*conn).serve(0xc00024a000, {0xcba870, 0xc0002160c0})
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:1991 +0x607
2023-01-09 10:26:13 created by net/http.(*Server).Serve
2023-01-09 10:26:13     /usr/local/go/src/net/http/server.go:3102 +0x4db

I am using the default docker backend (filesystem), the OS is windows though docker.

@fsouza
Copy link
Owner

fsouza commented Jan 9, 2023

Oh, that's embarrassing. Will send a fix soon.

@fsouza fsouza added the bug label Jan 9, 2023
fsouza added a commit that referenced this issue Jan 9, 2023
I really thought this was being used in more places, but turns out it
isn't. Well, let's fix it :)

This exposes #1034.
fsouza added a commit that referenced this issue Jan 9, 2023
Now the only test that should be failing is the one for #1034.
fsouza added a commit that referenced this issue Jan 9, 2023
@fsouza fsouza closed this as completed in c6b5350 Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants