Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process attempted to call itself #948

Open
kxkannan opened this issue Apr 21, 2023 · 4 comments
Open

process attempted to call itself #948

kxkannan opened this issue Apr 21, 2023 · 4 comments

Comments

@kxkannan
Copy link

  • Do not use the issues tracker for help or support (try Elixir Forum, Slack, IRC, etc.)
  • Questions about how to contribute are fine.

Environment

  • Elixir & Erlang versions (elixir --version): 1.14.4
  • ExAws version mix deps |grep ex_aws: ex_aws 2.4.2
  • HTTP client version. IE for hackney do mix deps | grep hackney: hackney 1.18.1

Current behavior

Include code samples, errors and stacktraces if appropriate.

2023-04-21T16:22:42.458 [error] mfa=:gen_server.error_info/8 pid=<0.4531.0>  GenServer ExAws.Config.AuthCache terminating
** (stop) exited in: GenServer.call(ExAws.Config.AuthCache, {:refresh_awscli_config, "stx-in-nonprod", 30000}, 30000)
    ** (EXIT) process attempted to call itself
    (elixir 1.14.4) lib/gen_server.ex:1031: GenServer.call/3
    (ex_aws 2.4.2) lib/ex_aws/config.ex:181: ExAws.Config.retrieve_runtime_value/2
    (elixir 1.14.4) lib/stream.ex:612: anonymous fn/4 in Stream.map/2
    (elixir 1.14.4) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.4) lib/stream.ex:1813: Enumerable.Stream.do_each/4
    (elixir 1.14.4) lib/enum.ex:1150: Enum.find/3
    (ex_aws 2.4.2) lib/ex_aws/config.ex:162: anonymous fn/2 in ExAws.Config.retrieve_runtime_config/1
    (stdlib 4.3) maps.erl:411: :maps.fold_1/3
    (ex_aws 2.4.2) lib/ex_aws/config.ex:70: ExAws.Config.new/2
    (ex_aws 2.4.2) lib/ex_aws.ex:73: ExAws.request/2
    (ex_aws_sts 2.3.0) lib/ex_aws/sts/auth_cache/assume_role_credentials_adapter.ex:36: ExAws.STS.AuthCache.AssumeRoleCredentialsAdapter.get_security_credentials/3
    (ex_aws 2.4.2) lib/ex_aws/config/auth_cache.ex:83: ExAws.Config.AuthCache.attempt_credentials_refresh/5
    (ex_aws 2.4.2) lib/ex_aws/config/auth_cache.ex:73: ExAws.Config.AuthCache.refresh_awscli_config/3
    (ex_aws 2.4.2) lib/ex_aws/config/auth_cache.ex:50: ExAws.Config.AuthCache.handle_call/3
    (stdlib 4.3) gen_server.erl:1149: :gen_server.try_handle_call/4
    (stdlib 4.3) gen_server.erl:1178: :gen_server.handle_msg/6
    (stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.5004.0>): {:refresh_awscli_config, "stx-in-nonprod", 30000}
2023-04-21T16:22:42.467 [error] mfa=:gen_server.error_info/8 pid=<0.5004.0>  GenServer #PID<0.5004.0> terminating

Expected behavior

This error shouldn't appear.

Used to work until I updated to Elixir 1.14.4 and Erlang 25.3.

@kxkannan
Copy link
Author

FYI, this seems to happen in release 2.4.2. I don't see this error in 2.4.1

@geofflane
Copy link

geofflane commented May 12, 2023

Saw this trying to use ex_aws_sts for assumed role access. During the call to case adapter.adapt_auth_config(auth, profile, expiration) do the plugin initiates a new request which attempts to access the Genserver again. That is a deadlock and so fails.

That still happens in 2.4.1 as well though. That seems like a fundamental problem with the assumed role authentication use case.

e.g.

config :ex_aws,
  secret_access_key: [{:awscli, "fb2b_staging", 30}],
  access_key_id: [{:awscli, "fb2b_staging", 30}],
  awscli_auth_adapter: ExAws.STS.AuthCache.AssumeRoleCredentialsAdapter,
  awscli_credentials: %{
    "default" => %{
      secret_access_key: [{:awscli, "default", 30}],
      access_key_id: [{:awscli, "default", 30}],
    },
    "fb2b_staging" => %{
      role_arn: "arn:aws:iam::xxxxxxx:role/fb2b-developer-role",
      source_profile: "default"
    }
  }

@bernardd
Copy link
Contributor

bernardd commented Jun 9, 2023

Thanks for the report. This one's gonna need some thinking - the short version is that the the auth cache is trying to update itself which is triggering a request which is (for some reason) trying to get credentials by calling the auth cache. I'm going to have to do some digging to figure out exactly what the right solution is.

@blimmer
Copy link

blimmer commented Jan 5, 2024

Linking this up with ex-aws/ex_aws_sts#35, the issue on the ex_aws_sts plugin page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants