{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-go/issues/251","labels_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/251/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/251/events","html_url":"https://github.com/aws/aws-sdk-go/issues/251","id":82162683,"number":251,"title":"ec2 function newRequest panics instead of returning an error","user":{"login":"purohit","id":336266,"avatar_url":"https://avatars.githubusercontent.com/u/336266?v=3","gravatar_id":"","url":"https://api.github.com/users/purohit","html_url":"https://github.com/purohit","followers_url":"https://api.github.com/users/purohit/followers","following_url":"https://api.github.com/users/purohit/following{/other_user}","gists_url":"https://api.github.com/users/purohit/gists{/gist_id}","starred_url":"https://api.github.com/users/purohit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purohit/subscriptions","organizations_url":"https://api.github.com/users/purohit/orgs","repos_url":"https://api.github.com/users/purohit/repos","events_url":"https://api.github.com/users/purohit/events{/privacy}","received_events_url":"https://api.github.com/users/purohit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-go/labels/feedback%20requested","name":"feedback requested","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-05-28T23:06:23Z","updated_at":"2015-06-26T21:08:02Z","closed_at":"2015-06-26T20:56:05Z","body":"When I exceed limit requests because of a high request rate, sometimes the ec2 client will panic. It would be better to simply return an error. Trace:\r\n\r\n```\r\npanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal 0xb code=0x1 addr=0x0 pc=0x4a25df]\r\n\r\ngoroutine 59 [running]:\r\ngithub.com/awslabs/aws-sdk-go/service/ec2.(*EC2).newRequest(0x0, 0xc2082ca570, 0x6e0d00, 0xc2082c2100, 0x6e0400, 0x0, 0xc209037680)\r\n        /home/apurohit/gocode/src/github.com/awslabs/aws-sdk-go/service/ec2/service.go:51 +0x1f\r\ngithub.com/awslabs/aws-sdk-go/service/ec2.(*EC2).RunInstancesRequest(0x0, 0xc2082c2100, 0x0, 0x0)\r\n        /home/apurohit/gocode/src/github.com/awslabs/aws-sdk-go/service/ec2/api.go:6401 +0x17d\r\ngithub.com/awslabs/aws-sdk-go/service/ec2.(*EC2).RunInstances(0x0, 0xc2082c2100, 0xc2082d4448, 0x0, 0x0)\r\n        /home/apurohit/gocode/src/github.com/awslabs/aws-sdk-go/service/ec2/api.go:6441 +0x44\r\nmain.(*ec2Instance).start(0xc2090b8c00, 0xc2083f68f0, 0x0, 0x0)\r\n```\r\n\r\nOffending code:\r\n\r\n```go\r\n// newRequest creates a new request for a EC2 operation and runs any\r\n// custom request initialization.\r\nfunc (c *EC2) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\r\n\treq := aws.NewRequest(c.Service, op, params, data) // <---- This blows up\r\n\r\n\t// Run custom request initialization if present\r\n\tif initRequest != nil {\r\n\t\tinitRequest(req)\r\n\t}\r\n\r\n\treturn req\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-go/issues/comments/115883758","html_url":"https://github.com/aws/aws-sdk-go/issues/251#issuecomment-115883758","issue_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/251","id":115883758,"user":{"login":"purohit","id":336266,"avatar_url":"https://avatars.githubusercontent.com/u/336266?v=3","gravatar_id":"","url":"https://api.github.com/users/purohit","html_url":"https://github.com/purohit","followers_url":"https://api.github.com/users/purohit/followers","following_url":"https://api.github.com/users/purohit/following{/other_user}","gists_url":"https://api.github.com/users/purohit/gists{/gist_id}","starred_url":"https://api.github.com/users/purohit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/purohit/subscriptions","organizations_url":"https://api.github.com/users/purohit/orgs","repos_url":"https://api.github.com/users/purohit/repos","events_url":"https://api.github.com/users/purohit/events{/privacy}","received_events_url":"https://api.github.com/users/purohit/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T21:08:02Z","updated_at":"2015-06-26T21:08:02Z","body":"OK, thanks for the tips! I don't see anywhere in the code it would be possible that I'm using the client prior to it being created, but if I discover I was doing something stupid, I'll post it."}}