{"action":"created","issue":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/865","repository_url":"https://api.github.com/repos/rusoto/rusoto","labels_url":"https://api.github.com/repos/rusoto/rusoto/issues/865/labels{/name}","comments_url":"https://api.github.com/repos/rusoto/rusoto/issues/865/comments","events_url":"https://api.github.com/repos/rusoto/rusoto/issues/865/events","html_url":"https://github.com/rusoto/rusoto/issues/865","id":271796082,"node_id":"MDU6SXNzdWUyNzE3OTYwODI=","number":865,"title":"Sharing StsAssumeRoleSessionCredentialsProvider instances between threads","user":{"login":"mdashti","id":3135608,"node_id":"MDQ6VXNlcjMxMzU2MDg=","avatar_url":"https://avatars2.githubusercontent.com/u/3135608?v=4","gravatar_id":"","url":"https://api.github.com/users/mdashti","html_url":"https://github.com/mdashti","followers_url":"https://api.github.com/users/mdashti/followers","following_url":"https://api.github.com/users/mdashti/following{/other_user}","gists_url":"https://api.github.com/users/mdashti/gists{/gist_id}","starred_url":"https://api.github.com/users/mdashti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdashti/subscriptions","organizations_url":"https://api.github.com/users/mdashti/orgs","repos_url":"https://api.github.com/users/mdashti/repos","events_url":"https://api.github.com/users/mdashti/events{/privacy}","received_events_url":"https://api.github.com/users/mdashti/received_events","type":"User","site_admin":false},"labels":[{"id":236362904,"node_id":"MDU6TGFiZWwyMzYzNjI5MDQ=","url":"https://api.github.com/repos/rusoto/rusoto/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-07T11:19:59Z","updated_at":"2018-08-15T16:27:07Z","closed_at":null,"author_association":"NONE","body":"I have a multi-threaded application and want to create a `rusoto_s3::S3Client` instance and pass it between threads. As my AWS organization is using roles for giving read/write permissions with MFA, I had to use `rusoto_sts::custom::credential::StsAssumeRoleSessionCredentialsProvider`. However, unlike `DefaultCredentialsProviderSync`, `StsAssumeRoleSessionCredentialsProvider` cannot be passed between threads safely and I get the following error:\r\n\r\n```\r\nerror[E0277]: the trait bound `rusoto_sts::custom::credential::StsSessionCredentialsClient + 'static: std::marker::Send` is not satisfied\r\n   --> src/store/mod.rs:371:27\r\n    |\r\n371 |             children.push(thread::spawn(move || {\r\n    |                           ^^^^^^^^^^^^^ `rusoto_sts::custom::credential::StsSessionCredentialsClient + 'static` cannot be sent between threads safely\r\n    |\r\n    = help: the trait `std::marker::Send` is not implemented for `rusoto_sts::custom::credential::StsSessionCredentialsClient + 'static`\r\n    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<rusoto_sts::custom::credential::StsSessionCredentialsClient + 'static>`\r\n    = note: required because it appears within the type `std::boxed::Box<rusoto_sts::custom::credential::StsSessionCredentialsClient + 'static>`\r\n    = note: required because it appears within the type `rusoto_sts::StsAssumeRoleSessionCredentialsProvider`\r\n    = note: required because it appears within the type `rusoto_s3::S3Client<rusoto_sts::StsAssumeRoleSessionCredentialsProvider, hyper::Client>`\r\n```\r\n\r\nDo you know if there is way to get around the issue? Or, it requires implementing StsAssumeRoleSessionCredentialsProviderSync?\r\n\r\nHere is the code that creates the provider:\r\n\r\n```rust\r\nlet mut profile_provider = ProfileProvider::new().unwrap();\r\nlet env_profile = match env_var(\"AWS_PROFILE\") {\r\n    Ok(val) => val,\r\n    Err(_) => panic!(\"No AWS_PROFILE in environment\")\r\n};\r\nprofile_provider.set_profile(env_profile);\r\nlet chain_provider = ChainProvider::with_profile_provider(profile_provider);\r\nlet credentials = DefaultCredentialsProviderSync::with_mutex(chain_provider).unwrap();\r\n\r\nlet env_role_arn = match env_var(\"AWS_ROLE_ARN\") {\r\n    Ok(val) => val,\r\n    Err(_) => panic!(\"No AWS_ROLE_ARN in environment\")\r\n};\r\n\r\nlet sts = StsClient::new(default_tls_client().unwrap(), credentials, Region::EuWest1);\r\n\r\nlet provider = StsAssumeRoleSessionCredentialsProvider::new(\r\n    sts,\r\n    env_role_arn,\r\n    \"default\".to_owned(),\r\n    None, None, None, None\r\n);\r\n```"},"comment":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/comments/413252944","html_url":"https://github.com/rusoto/rusoto/issues/865#issuecomment-413252944","issue_url":"https://api.github.com/repos/rusoto/rusoto/issues/865","id":413252944,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMzI1Mjk0NA==","user":{"login":"llambda","id":6763826,"node_id":"MDQ6VXNlcjY3NjM4MjY=","avatar_url":"https://avatars0.githubusercontent.com/u/6763826?v=4","gravatar_id":"","url":"https://api.github.com/users/llambda","html_url":"https://github.com/llambda","followers_url":"https://api.github.com/users/llambda/followers","following_url":"https://api.github.com/users/llambda/following{/other_user}","gists_url":"https://api.github.com/users/llambda/gists{/gist_id}","starred_url":"https://api.github.com/users/llambda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llambda/subscriptions","organizations_url":"https://api.github.com/users/llambda/orgs","repos_url":"https://api.github.com/users/llambda/repos","events_url":"https://api.github.com/users/llambda/events{/privacy}","received_events_url":"https://api.github.com/users/llambda/received_events","type":"User","site_admin":false},"created_at":"2018-08-15T16:27:07Z","updated_at":"2018-08-15T16:27:07Z","author_association":"NONE","body":"Thanks for proposing this; I'm running into the same problem while trying to upgrade from `0.32.0` to `0.33.1`."}}
{"actor":{"display_login":"llambda"}}