epgsql / pgapp

Erlang Postgres application that uses Poolboy and deals with the database being unavailable
MIT License
66 stars 42 forks source link

Erlang 22 compatibility #28

Closed technion closed 5 years ago

technion commented 5 years ago

Hi,

I updated my machine to Erlang 22, and I appear to be experiencing issuers connecting to databases using pgapp.

  module 'domain_parse'
    %% Unknown error: {abort,
                {setup_failed,
                 {error,
                  {badmatch,
                   {error,
                    {{{badmatch,
                       {error,
                        {{function_clause,
                          [{epgsql_cmd_connect,init,
                            [#{database => "ct_advisor",
                               hostname => "localhost",
                               password => #Fun<epgsql_cmd_connect.0.22692172>,
                               size => 5,username => "ct_advisor"}],
                            [{file,
                              default/lib/epgsql/src/commands/epgsql_cmd_connect.erl"},
                             {line,45}]},
                           {epgsql_sock,command_new,4,
                            [{file,
                              _build/default/lib/epgsql/src/epgsql_sock.erl"},
                             {line,256}]},
                           {gen_server,try_handle_call,4,
                            [{file,"gen_server.erl"},{line,661}]},
                           {gen_server,handle_msg,6,
                            [{file,"gen_server.erl"},{line,690}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,249}]}]},
                         {gen_server,call,
                          [<0.344.0>,
                           {command,epgsql_cmd_connect,
                            #{database => "ct_advisor",
                              hostname => "localhost",
                              password => #Fun<epgsql_cmd_connect.0.22692172>,
                              size => 5,username => "ct_advisor"}},
                           infinity]}}}},
                      [{poolboy,new_worker,1,
                        [{file,
                          _build/default/lib/poolboy/src/poolboy.erl"},
                         {line,283}]},
                       {poolboy,prepopulate,3,
                        [{file,
                         _build/default/lib/poolboy/src/poolboy.erl"},
                         {line,304}]},
                       {poolboy,init,3,
                        [{file,
                          _build/default/lib/poolboy/src/poolboy.erl"},
                         {line,153}]},
                       {gen_server,init_it,2,
                        [{file,"gen_server.erl"},{line,374}]},
                       {gen_server,init_it,6,
                        [{file,"gen_server.erl"},{line,342}]},
                       {proc_lib,init_p_do_apply,3,
                        [{file,"proc_lib.erl"},{line,249}]}]},
                     {child,undefined,epgsql_pool,
                      {poolboy,start_link,
                       [[{name,{local,epgsql_pool}},
                         {worker_module,pgapp_worker},
                         {size,5},
                         {max_overflow,5}],
                        [{size,5},
                         {hostname,"localhost"},
                         {username,"ct_advisor_int_live"},

I can connect fine using egpsql directly, and I've tried a fork with the latest poolboy and stable egpsql without any changes.

I'm happy to help investigate and patch this any way I can, but I'm having a hard time finding the root issue.

technion commented 5 years ago

Sorry for the timewasting. I can't see what else may or may not have changed here, but where my code used:

hostname => "localhost"

The correct variable is just "host". Again I don't see why this used to work, but it's not your problem.