Panic in 0.8.0 #65

Closed
opened 2025-12-28 18:00:02 +00:00 by sami · 4 comments
Owner

Originally created by @roman-khimov on GitHub (Mar 19, 2024).

Originally assigned to: @smallhive on GitHub.

Current Behavior

Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024-03-19T08:07:08.192Z        error        neofs-rest-gw/main.go:64        unknown scheme        {"scheme": "["}
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024-03-19T08:07:08.192Z        error        neofs-rest-gw/main.go:64        unknown scheme        {"scheme": "]"}
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024/03/19 08:07:08 WARN: OapiRequestValidatorWithOptions called with an OpenAPI spec that has `Servers` set. This may lead to an HTTP 400 with `no matching operation was found` when sending a valid request, as the validator performs `Host` header validation. If you're expecting `Host` header validation, you can silence this warning by setting `Options.SilenceServersWarning = true`. See https://github.com/deepmap/oapi-codegen/issues/882 for more information.
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: panic: runtime error: invalid memory address or nil pointer dereference
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xcda2e2]
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: goroutine 1 [running]:
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi/routers/gorillamux.makeServers({0xc001b9f7a0, 0x3, 0x0?})
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]:         github.com/getkin/kin-openapi@v0.118.0/routers/gorillamux/router.go:132 +0xa2
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi/routers/gorillamux.NewRouter(0xc0001d8cf0)
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]:         github.com/getkin/kin-openapi@v0.118.0/routers/gorillamux/router.go:52 +0x39
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware.OapiRequestValidatorWithOptions(0xc0001d8cf0?, 0x0)
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]:         github.com/oapi-codegen/echo-middleware@v1.0.1/oapi_validate.go:86 +0xa6
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware.OapiRequestValidator(...)
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]:         github.com/oapi-codegen/echo-middleware@v1.0.1/oapi_validate.go:58
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: main.main()
Mar 19 08:07:08 metis4 neofs-rest-gw[145480]:         github.com/nspcc-dev/neofs-rest-gw/cmd/neofs-rest-gw/main.go:81 +0xb4e
Mar 19 08:07:08 metis4 systemd[1]: neofs-rest.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

Expected Behavior

REST working fine.

Possible Solution

Fix it.

Steps to Reproduce

Run the gateway -- boom.

Regression

Yes, 0.8.0 breaks with the config that worked fine for 0.7.2.

Your Environment

  • Version of the product used: 0.8.0
  • Server setup and configuration files used:
logger:
  level: info
pool:
  error-threshold: 100
  healthcheck-timeout: 5s
  node-dial-timeout: 5s
  peers:
    0:
      address: st1.storage.fs.neo.org:8080
      priority: 2
      weight: 1
    1:
      address: st2.storage.fs.neo.org:8080
      priority: 2
      weight: 1
    2:
      address: st3.storage.fs.neo.org:8080
      priority: 2
      weight: 1
    3:
      address: st4.storage.fs.neo.org:8080
      priority: 1
      weight: 1
  rebalance-timer: 30s
pprof:
  address: localhost:9942
  enabled: true
prometheus:
  address: localhost:9941
  enabled: true
server:
  cleanup-timeout: 10s
  external-address: https://rest.fs.neo.org
  graceful-timeout: 15s
  keep-alive: 1m
  listen-address: localhost:8880
  listen-limit: 0
  max-header-size: 1000000
  read-timeout: 30s
  scheme: '[ http ]'
  write-timeout: 30s
wallet:
Originally created by @roman-khimov on GitHub (Mar 19, 2024). Originally assigned to: @smallhive on GitHub. ## Current Behavior ``` Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024-03-19T08:07:08.192Z error neofs-rest-gw/main.go:64 unknown scheme {"scheme": "["} Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024-03-19T08:07:08.192Z error neofs-rest-gw/main.go:64 unknown scheme {"scheme": "]"} Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: 2024/03/19 08:07:08 WARN: OapiRequestValidatorWithOptions called with an OpenAPI spec that has `Servers` set. This may lead to an HTTP 400 with `no matching operation was found` when sending a valid request, as the validator performs `Host` header validation. If you're expecting `Host` header validation, you can silence this warning by setting `Options.SilenceServersWarning = true`. See https://github.com/deepmap/oapi-codegen/issues/882 for more information. Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: panic: runtime error: invalid memory address or nil pointer dereference Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xcda2e2] Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: goroutine 1 [running]: Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi/routers/gorillamux.makeServers({0xc001b9f7a0, 0x3, 0x0?}) Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi@v0.118.0/routers/gorillamux/router.go:132 +0xa2 Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi/routers/gorillamux.NewRouter(0xc0001d8cf0) Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/getkin/kin-openapi@v0.118.0/routers/gorillamux/router.go:52 +0x39 Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware.OapiRequestValidatorWithOptions(0xc0001d8cf0?, 0x0) Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware@v1.0.1/oapi_validate.go:86 +0xa6 Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware.OapiRequestValidator(...) Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/oapi-codegen/echo-middleware@v1.0.1/oapi_validate.go:58 Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: main.main() Mar 19 08:07:08 metis4 neofs-rest-gw[145480]: github.com/nspcc-dev/neofs-rest-gw/cmd/neofs-rest-gw/main.go:81 +0xb4e Mar 19 08:07:08 metis4 systemd[1]: neofs-rest.service: Main process exited, code=exited, status=2/INVALIDARGUMENT ``` ## Expected Behavior REST working fine. ## Possible Solution Fix it. ## Steps to Reproduce Run the gateway -- boom. ## Regression Yes, 0.8.0 breaks with the config that worked fine for 0.7.2. ## Your Environment * Version of the product used: 0.8.0 * Server setup and configuration files used: ``` logger: level: info pool: error-threshold: 100 healthcheck-timeout: 5s node-dial-timeout: 5s peers: 0: address: st1.storage.fs.neo.org:8080 priority: 2 weight: 1 1: address: st2.storage.fs.neo.org:8080 priority: 2 weight: 1 2: address: st3.storage.fs.neo.org:8080 priority: 2 weight: 1 3: address: st4.storage.fs.neo.org:8080 priority: 1 weight: 1 rebalance-timer: 30s pprof: address: localhost:9942 enabled: true prometheus: address: localhost:9941 enabled: true server: cleanup-timeout: 10s external-address: https://rest.fs.neo.org graceful-timeout: 15s keep-alive: 1m listen-address: localhost:8880 listen-limit: 0 max-header-size: 1000000 read-timeout: 30s scheme: '[ http ]' write-timeout: 30s wallet: ```
sami 2025-12-28 18:00:02 +00:00
  • closed this issue
  • added the
    bug
    S4
    I4
    U1
    labels
Author
Owner

@roman-khimov commented on GitHub (Mar 19, 2024):

It starts OK without scheme: '[ http ]'.

@roman-khimov commented on GitHub (Mar 19, 2024): It starts OK without `scheme: '[ http ]'`.
Author
Owner

@roman-khimov commented on GitHub (Mar 19, 2024):

Fixed by https://github.com/nspcc-dev/ansible-neofs/pull/24, gateway behavior is correct here, but please add an "upgrading" note to the changelog.

@roman-khimov commented on GitHub (Mar 19, 2024): Fixed by https://github.com/nspcc-dev/ansible-neofs/pull/24, gateway behavior is correct here, but please add an "upgrading" note to the changelog.
Author
Owner

@smallhive commented on GitHub (Mar 19, 2024):

It is an array, not the string nspcc-dev/neofs-rest-gw@de5a86201d/config/config.yaml (L55)

@smallhive commented on GitHub (Mar 19, 2024): It is an array, not the string https://github.com/nspcc-dev/neofs-rest-gw/blob/de5a86201de5cffc7c8e6feed5888268e30e08dc/config/config.yaml#L55
Author
Owner

@roman-khimov commented on GitHub (Mar 19, 2024):

Sure, but the behavior has changed (even though the old one was incorrect) and it can be mentioned in changelog.

@roman-khimov commented on GitHub (Mar 19, 2024): Sure, but the behavior has changed (even though the old one was incorrect) and it can be mentioned in changelog.
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
nspcc-dev/neofs-rest-gw#65
No description provided.