This repository was archived by the owner on Nov 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 355
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Internal Server Error when missing key in POST to /deliveryservice_requests #5012
Copy link
Copy link
Closed
Closed
Copy link
Labels
Traffic Opsrelated to Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedsomething isn't working as intendedlow impactaffects only a small portion of a CDN, and cannot itself break oneaffects only a small portion of a CDN, and cannot itself break one
Description
I'm submitting a ...
- bug report
Traffic Control components affected ...
- Traffic Ops
Current behavior:
When passing a request that's missing the deliveryservice property to /deliveryservice_request's POST handler, the request's goroutine will segfault and panic.
Expected / new behavior:
Invalid requests should not be capable of causing a server-side segfault.
Minimal reproduction of the problem with instructions:
POST to /deliveryservice_request with a request body not containing a deliveryservice property (probably "deliveryservice": null works too, but I haven't checked). Simplest body to reproduce the error is just {}.
Anything else:
Full HTTP stack
POST /api/2.0/deliveryservice_requests HTTP/1.1
User-Agent: python-requests/2.22.0
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
Cookie: mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTkxODIwNjQsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--fd12037b48601a4f29a16fd06a9881c19be9456b
Content-Length: 2
{}HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Set-Cookie, Cookie
Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE
Access-Control-Allow-Origin: *
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: mojolicious=eyJhdXRoX2RhdGEiOiJhZG1pbiIsImV4cGlyZXMiOjE1OTkxNjQwNjQsImJ5IjoidHJhZmZpY2NvbnRyb2wtZ28tdG9jb29raWUifQ--de133c58fd1afe4b253fe6d920be7002dfdb4513; Path=/; Expires=Thu, 03 Sep 2020 20:14:24 GMT; Max-Age=3600; HttpOnly
Vary: Accept-Encoding
Whole-Content-Sha512: /HT8WHLIsAIPgTPjZAa4GmpUwYtwph3fcU1//Cr7W4rkL1lKRW3kUEDTIz1DoA3/zUm3oa0elunc5VHcism6Qg==
X-Server-Name: traffic_ops_golang/
Date: Thu, 03 Sep 2020 19:14:24 GMT
Content-Length: 83
{
"alerts": [
{
"text": "Internal Server Error",
"level": "error"
}
]
}Traffic Ops Logs
INFO: routing.go:249: 2020-09-03T19:05:31.140864324Z: POST /api/2.0/deliveryservice_requests? handling (reqid 2750)
DEBUG: plugin.go:190: 2020-09-03T19:05:31.140914016Z: DEBUG plugins.OnRequest calling 0 plugins
ERROR: api.go:222: 2020-09-03T19:05:31.151730185Z: 192.168.176.1:41492 panic: (err: runtime error: invalid memory address or nil pointer dereference) stacktrace:
goroutine 21149 [running]:
github.com/apache/trafficcontrol/lib/go-util.Stacktrace(0xc000fed398, 0xce4900, 0x15d8b00)
/tmp/go/src/github.com/apache/trafficcontrol/lib/go-util/util.go:32 +0x9d
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1.1(0xf74760, 0xc0016a17d0, 0xc001368400)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:152 +0x54
panic(0xce4900, 0x15d8b00)
/usr/local/go/src/runtime/panic.go:969 +0x166
github.com/apache/trafficcontrol/lib/go-tc.(*DeliveryServiceNullable).Validate(0x0, 0xc000f98100, 0x3, 0x4)
/tmp/go/src/github.com/apache/trafficcontrol/lib/go-tc/deliveryservices.go:543 +0x263
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/deliveryservice/request.(*TODeliveryServiceRequest).Validate(0xc000eda000, 0xda2260, 0xc000eda000)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/deliveryservice/request/validate.go:63 +0x43e
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.decodeAndValidateRequestBody(0xc001368400, 0x7f9b62f5e2b8, 0xc000eda000, 0x0, 0x0)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api/shared_handlers.go:115 +0x13d
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api.CreateHandler.func1(0xf74760, 0xc0016a17d0, 0xc001368400)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/api/shared_handlers.go:615 +0x10da
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.AuthBase.GetWrapper.func1.1(0xf74760, 0xc0016a17d0, 0xc001368400)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:107 +0x276
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapPanicRecover.func1(0xf74760, 0xc0016a17d0, 0xc001368400)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:156 +0x79
github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware.WrapHeaders.func1(0xf775e0, 0xc00333c420, 0xc001368400)
/tmp/go/src/github.com/apache/trafficcontrol/traffic_ops/traffic_ops_golang/routing/middleware/wrappers.go:136 +0x643
net/http.HandlerFunc.ServeHTTP(0xc00047e9b0, 0xf775e0, 0xc00333c420, 0xc001368400)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*timeoutHandler).ServeHTTP.func1(0xc00333c540, 0xc000191c40, 0xc00333c420, 0xc001368400, 0xc000114360)
/usr/local/go/src/net/http/server.go:3238 +0x7f
created by net/http.(*timeoutHandler).ServeHTTP
/usr/local/go/src/net/http/server.go:3232 +0x226
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Traffic Opsrelated to Traffic Opsrelated to Traffic Opsbugsomething isn't working as intendedsomething isn't working as intendedlow impactaffects only a small portion of a CDN, and cannot itself break oneaffects only a small portion of a CDN, and cannot itself break one