{"action":"closed","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-go/issues/679","repository_url":"https://api.github.com/repos/aws/aws-sdk-go","labels_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/679/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/679/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-go/issues/679/events","html_url":"https://github.com/aws/aws-sdk-go/issues/679","id":154032752,"number":679,"title":"Data Race in s3manager","user":{"login":"eldondevcg","id":12100413,"avatar_url":"https://avatars.githubusercontent.com/u/12100413?v=3","gravatar_id":"","url":"https://api.github.com/users/eldondevcg","html_url":"https://github.com/eldondevcg","followers_url":"https://api.github.com/users/eldondevcg/followers","following_url":"https://api.github.com/users/eldondevcg/following{/other_user}","gists_url":"https://api.github.com/users/eldondevcg/gists{/gist_id}","starred_url":"https://api.github.com/users/eldondevcg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eldondevcg/subscriptions","organizations_url":"https://api.github.com/users/eldondevcg/orgs","repos_url":"https://api.github.com/users/eldondevcg/repos","events_url":"https://api.github.com/users/eldondevcg/events{/privacy}","received_events_url":"https://api.github.com/users/eldondevcg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-go/labels/Bug","name":"Bug","color":"fc2929"},{"url":"https://api.github.com/repos/aws/aws-sdk-go/labels/Feedback%20Requested","name":"Feedback Requested","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"jasdel","id":961963,"avatar_url":"https://avatars.githubusercontent.com/u/961963?v=3","gravatar_id":"","url":"https://api.github.com/users/jasdel","html_url":"https://github.com/jasdel","followers_url":"https://api.github.com/users/jasdel/followers","following_url":"https://api.github.com/users/jasdel/following{/other_user}","gists_url":"https://api.github.com/users/jasdel/gists{/gist_id}","starred_url":"https://api.github.com/users/jasdel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasdel/subscriptions","organizations_url":"https://api.github.com/users/jasdel/orgs","repos_url":"https://api.github.com/users/jasdel/repos","events_url":"https://api.github.com/users/jasdel/events{/privacy}","received_events_url":"https://api.github.com/users/jasdel/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-05-10T15:15:28Z","updated_at":"2016-05-13T01:01:56Z","closed_at":"2016-05-13T01:01:56Z","body":"I am experiencing the following data race when using the s3manager:\r\n```\r\n==================\r\nWARNING: DATA RACE\r\nWrite by goroutine 91:\r\n  runtime.mapdelete()\r\n      /usr/local/golang/1.6.2/go/src/runtime/hashmap.go:545 +0x0\r\n  net/textproto.MIMEHeader.Del()\r\n      /usr/local/golang/1.6.2/go/src/net/textproto/header.go:42 +0x70\r\n  net/http.Header.Del()\r\n      /usr/local/golang/1.6.2/go/src/net/http/header.go:52 +0x42\r\n  github.com/aws/aws-sdk-go/aws/corehandlers.glob.func1()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go:57 +0x3ce\r\n  github.com/aws/aws-sdk-go/aws/request.(*HandlerList).Run()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/aws/request/handlers.go:136 +0x100\r\n  github.com/aws/aws-sdk-go/aws/request.(*Request).Sign()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go:216 +0x130\r\n  github.com/aws/aws-sdk-go/aws/request.(*Request).Send()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/aws/request/request.go:258 +0xbbf\r\n  github.com/aws/aws-sdk-go/service/s3/s3manager.(*downloader).downloadChunk()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go:243 +0x61c\r\n  github.com/aws/aws-sdk-go/service/s3/s3manager.(*downloader).downloadPart()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go:217 +0x125\r\n\r\nPrevious read by goroutine 65:\r\n  net/http.Header.sortedKeyValues()\r\n      /usr/local/golang/1.6.2/go/src/net/http/header.go:129 +0xdd\r\n  net/http.Header.WriteSubset()\r\n      /usr/local/golang/1.6.2/go/src/net/http/header.go:150 +0x188\r\n  net/http.(*Request).write()\r\n      /usr/local/golang/1.6.2/go/src/net/http/request.go:464 +0xc31\r\n  net/http.(*persistConn).writeLoop()\r\n      /usr/local/golang/1.6.2/go/src/net/http/transport.go:1283 +0x382\r\n\r\nGoroutine 91 (running) created at:\r\n  github.com/aws/aws-sdk-go/service/s3/s3manager.(*downloader).download()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go:167 +0x1c8\r\n  github.com/aws/aws-sdk-go/service/s3/s3manager.Downloader.Download()\r\n      /home/runner/workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go:121 +0x1a1\r\n  main.stream_result.func1()\r\n      /home/runner/workspace/src/XXXXXXXXXXXXXXXXX:97 +0x2f0\r\n\r\nGoroutine 65 (running) created at:\r\n  net/http.(*Transport).dialConn()\r\n      /usr/local/golang/1.6.2/go/src/net/http/transport.go:858 +0x1714\r\n  net/http.(*Transport).getConn.func4()\r\n      /usr/local/golang/1.6.2/go/src/net/http/transport.go:706 +0x73\r\n```\r\n\r\nThe calling code looks like this:\r\n```\r\nfunc stream_result(s3Destination s3.GetObjectInput) (return_err error) {\r\n\tfor trys := 0; trys < 3; trys++ {\r\n\t\tcomplete := make(chan Bytes)\r\n\t\tgo func() {\r\n\t\t\tdownloader := s3manager.NewDownloader(session.New(&aws.Config{Region: aws.String(\"us-east-1\")}))\r\n\t\t\tout := &aws.WriteAtBuffer{}\r\n\t\t\t_, err := downloader.Download(out, &s3Destination)\r\n\t\t\tif err != nil {\r\n\t\t\t\tlog.Printf(\"Encountered an error downloading: %+v\", err)\r\n\t\t\t}\r\n\t\t\tcomplete <- out\r\n\t\t\tclose(complete)\r\n\t\t}()\r\n\t\tselect {\r\n\t\tcase dump := <-complete:\r\n\t\t\tos.Stdout.Write(dump.Bytes())\r\n\t\t\treturn nil\r\n\t\tcase <-time.After(5 * time.Minute):\r\n\t\t\tlog.Printf(\"S3 object fetch timeout, retrying\")\r\n\t\t}\r\n\t}\r\n\treturn errors.New(\"S3 object fetch timeout, failing\")\r\n}\r\n```"}}