quiqupltd / ueberauth_token

UeberauthToken is a library which helps validate an oauth2 token received by the resource server. The token should be validated against the authorization server and an ueberauth struct constructed.
MIT License
6 stars 3 forks source link

Crash on timeout #8

Closed IanVaughan closed 6 years ago

IanVaughan commented 6 years ago
12:37:20.964 [error] GenServer :ueberauth_token_worker_oauth2_token_adapters_quiqup terminating
** (Protocol.UndefinedError) protocol String.Chars not implemented for #PID<0.1564.0>. This protocol is implemented for: Atom, BitString, Date, DateTime, Float, Integer, List, NaiveDateTime, Time, URI, Version, Version.Requirement
    (elixir) /usr/local/src/elixir/lib/elixir/lib/string/chars.ex:3: String.Chars.impl_for!/1
    (elixir) /usr/local/src/elixir/lib/elixir/lib/string/chars.ex:22: String.Chars.to_string/1
    (ueberauth_token) lib/ueberauth_token/worker.ex:191: UeberauthToken.Worker.worker_details/1
    (ueberauth_token) lib/ueberauth_token/worker.ex:85: UeberauthToken.Worker.terminate/2
    (stdlib) gen_server.erl:648: :gen_server.try_terminate/3
    (stdlib) gen_server.erl:833: :gen_server.terminate/10
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: :timeout
12:37:20.964 [warning] lager_error_logger_h dropped 46 messages in the last second that exceeded the limit of 50 messages/sec

=CRASH REPORT==== 12-Sep-2018::12:37:20 ===
  crasher:
    initial call: Elixir.UeberauthToken.Worker:init/1
    pid: <0.1564.0>
    registered_name: ueberauth_token_worker_oauth2_token_adapters_quiqup
    exception error: #{'__exception__' => true,
                       '__struct__' => 'Elixir.Protocol.UndefinedError',
                       description => <<>>,protocol => 'Elixir.String.Chars',
                       value => <0.1564.0>}
      in function  'Elixir.String.Chars':'impl_for!'/1 (/usr/local/src/elixir/lib/elixir/lib/string/chars.ex, line 3)
      in call from 'Elixir.String.Chars':to_string/1 (/usr/local/src/elixir/lib/elixir/lib/string/chars.ex, line 22)
      in call from 'Elixir.UeberauthToken.Worker':worker_details/1 (lib/ueberauth_token/worker.ex, line 191)
      in call from 'Elixir.UeberauthToken.Worker':terminate/2 (lib/ueberauth_token/worker.ex, line 85)
      in call from gen_server:try_terminate/3 (gen_server.erl, line 648)
      in call from gen_server:terminate/10 (gen_server.erl, line 833)
    ancestors: ['Elixir.UeberauthToken.Supervisor',<0.1554.0>]
    message_queue_len: 0
    messages: []
    links: [<0.1555.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 1598
    stack_size: 27
    reductions: 2094
  neighbours:

=SUPERVISOR REPORT==== 12-Sep-2018::12:37:20 ===
     Supervisor: {local,'Elixir.UeberauthToken.Supervisor'}
     Context:    child_terminated
     Reason:     {#{'__exception__' => true,
                    '__struct__' => 'Elixir.Protocol.UndefinedError',
                    description => <<>>,protocol => 'Elixir.String.Chars',
                    value => <0.1564.0>},
                  [{'Elixir.String.Chars','impl_for!',1,
                       [{file,
                            "/usr/local/src/elixir/lib/elixir/lib/string/chars.ex"},
                        {line,3}]},
                   {'Elixir.String.Chars',to_string,1,
                       [{file,
                            "/usr/local/src/elixir/lib/elixir/lib/string/chars.ex"},
                        {line,22}]},
                   {'Elixir.UeberauthToken.Worker',worker_details,1,
                       [{file,"lib/ueberauth_token/worker.ex"},{line,191}]},
                   {'Elixir.UeberauthToken.Worker',terminate,2,
                       [{file,"lib/ueberauth_token/worker.ex"},{line,85}]},
                   {gen_server,try_terminate,3,
                       [{file,"gen_server.erl"},{line,648}]},
                   {gen_server,terminate,10,
                       [{file,"gen_server.erl"},{line,833}]},
                   {proc_lib,init_p_do_apply,3,
                       [{file,"proc_lib.erl"},{line,247}]}]}
     Offender:   [{pid,<0.1564.0>},
                  {id,'Elixir.UeberauthToken.Worker'},
                  {mfargs,
                      {'Elixir.UeberauthToken.Worker',start_link,
                          [[{provider,
                                'Elixir.Oauth2Token.Adapters.Quiqup'}]]}},
                  {restart_type,permanent},
                  {shutdown,5000},
                  {child_type,worker}]

12:37:20.964 [error] gen_server ueberauth_token_worker_oauth2_token_adapters_quiqup terminated with reason: #{'__exception__' => true,'__struct__' => 'Elixir.Protocol.UndefinedError',description => <<>>,protocol => 'Elixir.String.Chars',value => <0.1564.0>} in 'Elixir.String.Chars':'impl_for!'/1 line 3
12:37:20.964 [error] CRASH REPORT Process ueberauth_token_worker_oauth2_token_adapters_quiqup with 0 neighbours crashed with reason: #{'__exception__' => true,'__struct__' => 'Elixir.Protocol.UndefinedError',description => <<>>,protocol => 'Elixir.String.Chars',value => <0.1564.0>} in 'Elixir.String.Chars':'impl_for!'/1 line 3
12:37:20.965 [error] Supervisor 'Elixir.UeberauthToken.Supervisor' had child 'Elixir.UeberauthToken.Worker' started with 'Elixir.UeberauthToken.Worker':start_link([{provider,'Elixir.Oauth2Token.Adapters.Quiqup'}]) at <0.1564.0> exit with reason #{'__exception__' => true,'__struct__' => 'Elixir.Protocol.UndefinedError',description => <<>>,protocol => 'Elixir.String.Chars',value => <0.1564.0>} in 'Elixir.String.Chars':'impl_for!'/1 line 3 in context child_terminated
stephenmoloney commented 6 years ago

Hi @IanVaughan

Potentially a bug but more information needed first.

Need to rule out potential issue with the provider configuration.

Few pieces of useful information would be:

Another thing is that if you do not need background token checking, then you can disable the worker,

config :ueberauth_token, SomeProvider,
  background_checks: false