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

[bug] [HTTPPipeline] loadBalance is required but causes panic if missing #63

Closed
bigangryrobot opened this issue Jun 23, 2021 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bigangryrobot
Copy link
Contributor

bigangryrobot commented Jun 23, 2021

If you create an http pipeline without a loadBalance definition, like is given here, you will receive a panic

payload

name: something
kind: HTTPPipeline
flow:
  - filter: proxyToBackend
filters:
  - name: proxyToBackend
    kind: Proxy
    mainPool:
      servers:
      - url: some backend

client error

Error: 400: validate spec failed:
generalErrs:
- |
  filters: jsonschemaErrs:
  - 'mainPool: loadBalance is required'
  systemErr: 'BUG: call Validate for proxy.PoolSpec panic: runtime error: invalid memory
    address or nil pointer dereference'

exit status 1

server error

2021-06-23T19:09:03.093Z	ERROR	v/validaterecorder.go:145	BUG: call Validate for proxy.PoolSpec panic: runtime error: invalid memory address or nil pointer dereference: goroutine 305224 [running]:
runtime/debug.Stack(0x17c4de1, 0x23, 0xc000f56250)
	/usr/local/go/src/runtime/debug/stack.go:24 +0x9f
github.com/megaease/easegress/pkg/v.(*ValidateRecorder).recordGeneral.func1(0x7f8b8c218db8, 0xc00131a600, 0xc0015ebb00)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/validaterecorder.go:145 +0xf5
panic(0x1584bc0, 0x23145b0)
	/usr/local/go/src/runtime/panic.go:969 +0x1b9
github.com/megaease/easegress/pkg/filter/proxy.PoolSpec.Validate(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc000548928, 0x1, 0x1, 0x0, ...)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/filter/proxy/pool.go:89 +0xbf
github.com/megaease/easegress/pkg/v.(*ValidateRecorder).recordGeneral(0xc0015ebb00, 0xc0022ac0e0, 0x0)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/validaterecorder.go:150 +0x14b
github.com/megaease/easegress/pkg/v.traverseGo(0xc0022ac0e0, 0x0, 0xc000f56d58)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:185 +0xf2
github.com/megaease/easegress/pkg/v.traverseGo(0xc0022ac0a0, 0xc00103db20, 0xc000f56d58)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:214 +0x7a5
github.com/megaease/easegress/pkg/v.traverseGo(0xc001fb1fc0, 0x0, 0xc000f56d58)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:198 +0x657
github.com/megaease/easegress/pkg/v.traverseGo(0xc001fb1be0, 0x0, 0xc000f56d58)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:214 +0x7a5
github.com/megaease/easegress/pkg/v.Validate(0x158f700, 0xc000fc6850, 0xc0004bf030, 0x66, 0x70, 0x0)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:118 +0x77d
github.com/megaease/easegress/pkg/object/httppipeline.newFilterSpecInternal(0xc00229f230, 0xc001fab2c0, 0xc0021c6ab0, 0x7)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/object/httppipeline/spec.go:91 +0x457
github.com/megaease/easegress/pkg/object/httppipeline.Spec.Validate(0xc0019e26e0, 0x1, 0x1, 0xc0005486c0, 0x1, 0x1, 0xc000ed4c00, 0xafb, 0xc00, 0x0, ...)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/object/httppipeline/httppipeline.go:251 +0x2b3
github.com/megaease/easegress/pkg/v.Validate(0x15538a0, 0xc00229e750, 0xc000ed4c00, 0xafb, 0xc00, 0xc00)
	/go/pkg/mod/github.com/megaease/easegress@v1.0.0/pkg/v/v.go:107 +0x836
github.com/megaease/easegress/pkg/supervisor.NewSpec(0xc0005b1000, 0xafb, 0xafb, 0xc0005b1000, 0xafb)

Some notes on this

  • parser should never panic
  • errors should be clearer (look at k8s for examples)
@bigangryrobot
Copy link
Contributor Author

it should be notes as well that the docs seem to indicate that loadBalance is not required

https://github.com/megaease/easegress/blob/main/doc/filters.md#proxy

@localvar localvar self-assigned this Jun 24, 2021
@localvar localvar added the bug Something isn't working label Jun 24, 2021
@localvar localvar added this to the v1.0.1 milestone Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants