[GH-ISSUE #1034] Error when attempting to delete a missing bucket #159

Closed
opened 2026-03-03 12:08:49 +03:00 by kerem · 1 comment
Owner

Originally created by @bentheiii on GitHub (Jan 9, 2023).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1034

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.

Originally created by @bentheiii on GitHub (Jan 9, 2023). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1034 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.
kerem 2026-03-03 12:08:49 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@fsouza commented on GitHub (Jan 9, 2023):

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

<!-- gh-comment-id:1375547254 --> @fsouza commented on GitHub (Jan 9, 2023): Oh, that's embarrassing. Will send a fix soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#159
No description provided.