{"action":"created","issue":{"url":"https://api.github.com/repos/scality/S3/issues/929","repository_url":"https://api.github.com/repos/scality/S3","labels_url":"https://api.github.com/repos/scality/S3/issues/929/labels{/name}","comments_url":"https://api.github.com/repos/scality/S3/issues/929/comments","events_url":"https://api.github.com/repos/scality/S3/issues/929/events","html_url":"https://github.com/scality/S3/pull/929","id":263591268,"number":929,"title":"fix: undef client in multiplebackend head","user":{"login":"electrachong","id":15208707,"avatar_url":"https://avatars3.githubusercontent.com/u/15208707?v=4","gravatar_id":"","url":"https://api.github.com/users/electrachong","html_url":"https://github.com/electrachong","followers_url":"https://api.github.com/users/electrachong/followers","following_url":"https://api.github.com/users/electrachong/following{/other_user}","gists_url":"https://api.github.com/users/electrachong/gists{/gist_id}","starred_url":"https://api.github.com/users/electrachong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrachong/subscriptions","organizations_url":"https://api.github.com/users/electrachong/orgs","repos_url":"https://api.github.com/users/electrachong/repos","events_url":"https://api.github.com/users/electrachong/events{/privacy}","received_events_url":"https://api.github.com/users/electrachong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-10-06T22:44:35Z","updated_at":"2017-10-13T23:09:48Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/scality/S3/pulls/929","html_url":"https://github.com/scality/S3/pull/929","diff_url":"https://github.com/scality/S3/pull/929.diff","patch_url":"https://github.com/scality/S3/pull/929.patch"},"body":"Thanks to @bennettbuchanan for reporting a bug introduced by 7a02f4c58e6af3d4b36461a5303a01534925ca59 which crashes the service when using object GET without multiple backends (`S3DATA=multiple`).\r\n\r\nThe following error was thrown at the line https://github.com/scality/S3/blob/master/lib/data/multipleBackendGateway.js#L71:\r\n```\r\n{\"name\":\"S3\",\"time\":1507317236361,\"error\":\"Cannot read property 'head' of undefined\",\"stack\":\"TypeError: Cannot read property 'head' of undefined\\n    at Object.head (/Users/bennettbuchanan/repos/scality/S3/lib/data/multipleBackendGateway.js:72:19)\\n    at metadataValidateBucketAndObj (/Users/bennettbuchanan/repos/scality/S3/lib/api/objectGet.js:191:39)\\n    at async.waterfall (/Users/bennettbuchanan/repos/scality/S3/lib/metadata/metadataUtils.js:210:16)\\n    at /Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:421:16\\n    at next (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5302:29)\\n    at /Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:906:16\\n    at checkObjectAuth (/Users/bennettbuchanan/repos/scality/S3/lib/metadata/metadataUtils.js:203:20)\\n    at nextTask (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5297:14)\\n    at next (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5304:9)\\n    at /Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:906:16\\n    at handleNullVersionGet (/Users/bennettbuchanan/repos/scality/S3/lib/metadata/metadataUtils.js:193:20)\\n    at nextTask (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5297:14)\\n    at next (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5304:9)\\n    at /Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:906:16\\n    at checkBucketAuth (/Users/bennettbuchanan/repos/scality/S3/lib/metadata/metadataUtils.js:186:20)\\n    at nextTask (/Users/bennettbuchanan/repos/scality/S3/node_modules/async/dist/async.js:5297:14)\",\"workerId\":11,\"workerPid\":3244,\"level\":\"fatal\",\"message\":\"caught error\",\"hostname\":\"Bennetts-MacBook-Pro-2.local\",\"pid\":3244}\r\n```\r\n\r\nThe client was undefined in multipleBackendGateway because we were expecting the `dataStoreName` saved in `objectGetInfo` to be the name of  the location constraint (e.g. \"us-east-1\"), but it is `implName`(e.g. \"file\" or \"mem\") when not using `S3DATA=multiple` (see: https://github.com/scality/S3/blob/master/lib/data/wrapper.js#L118).\r\n\r\nThe error was not caught by our CI tests because we test with a locationConfig file that has location constraints named \"file\" and \"mem\" (coincidentally same as the `implNames`). The default locationConfig, which Bennett was testing with, does not have these location constraints.\r\n\r\nTesting locally with the default locationConfig file, the changes in this PR fix the bug, but creating tests for the CI will involve additional work since we either have to create an additional location config file to test with or modify the existing one (and related tests)."},"comment":{"url":"https://api.github.com/repos/scality/S3/issues/comments/336587798","html_url":"https://github.com/scality/S3/pull/929#issuecomment-336587798","issue_url":"https://api.github.com/repos/scality/S3/issues/929","id":336587798,"user":{"login":"electrachong","id":15208707,"avatar_url":"https://avatars3.githubusercontent.com/u/15208707?v=4","gravatar_id":"","url":"https://api.github.com/users/electrachong","html_url":"https://github.com/electrachong","followers_url":"https://api.github.com/users/electrachong/followers","following_url":"https://api.github.com/users/electrachong/following{/other_user}","gists_url":"https://api.github.com/users/electrachong/gists{/gist_id}","starred_url":"https://api.github.com/users/electrachong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrachong/subscriptions","organizations_url":"https://api.github.com/users/electrachong/orgs","repos_url":"https://api.github.com/users/electrachong/repos","events_url":"https://api.github.com/users/electrachong/events{/privacy}","received_events_url":"https://api.github.com/users/electrachong/received_events","type":"User","site_admin":false},"created_at":"2017-10-13T23:09:48Z","updated_at":"2017-10-13T23:09:48Z","author_association":"CONTRIBUTOR","body":"@ironman-machine try"}}
{"actor":{"display_login":"electrachong"}}