samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 47 forks source link

Google cloud_sql_proxy Ecto works fine but Rhianna dropping jobs? :econnrefused #67

Closed sensiblearts closed 5 years ago

sensiblearts commented 5 years ago

Windows 10 WSL (Ubuntu 16) Elixir 1.8, Phoenix 1.4 Postgres 9.6 (Google) Rihanna 1.3.1

Rihanna has been working fine in development; however, I am about to move to production, so I created a Postgres server at Google compute cloud, and installed cloud_sql_proxy on my laptop.

Note: I am not yet doing a release build; rather, I am just compiling and running MIX_ENV=prod on my laptop while connecting to the remote Postgres at Google using cloud_sql_proxy.

Cloud_sql_proxy works fine for almost everything:

MIX_ENV=prod mix ecto.create
MIX_ENV=prod mix ecto.migrate  # works fine

However:

MIX_ENV=prod mix phx.server  

Reveals unhandled errors:

18:51:43.557 [info] Running GjwappWeb.Endpoint with cowboy 2.6.3 at 0.0.0.0:4000 (http)
18:51:43.677 [info] Access GjwappWeb.Endpoint at http://localhost:4000
18:51:43.824 [error] Postgrex.Protocol (#PID<0.517.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
18:51:44.928 [error] Postgrex.Protocol (#PID<0.517.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
18:51:47.930 [error] Postgrex.Protocol (#PID<0.517.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
18:51:51.119 request_id=FaW9x6SqlTDl1QQAAAIh [info] GET /
18:51:51.339 request_id=FaW9x6SqlTDl1QQAAAIh [info] Sent 200 in 220ms
18:51:51.979 [error] GenServer Rihanna.JobDispatcher terminating
** (CaseClauseError) no case clause matching: {:error, %DBConnection.ConnectionError{message: "connection not available and request was dropped from queue after 2935ms. You can configure how long requests wait in the queue using :queue_target and :queue_interval. See DBConnection.start_link/2 for more information"}}
    (rihanna) lib/rihanna/migration.ex:173: Rihanna.Migration.check_table!/1
    (rihanna) lib/rihanna/job_dispatcher.ex:110: Rihanna.JobDispatcher.check_database!/1
    (rihanna) lib/rihanna/job_dispatcher.ex:31: Rihanna.JobDispatcher.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :initialise

So, is Rihanna not handling it properly or am I not setting it up properly?

How would you like me to proceed. I am happy to fork this and work on it with a bit of direction.

Also interesting beam toughness: Despite these error messages pouring out, I can run the app fine and do CRUD -- I just cannot get a Rihanna job processed.

Thanks. David

sensiblearts commented 5 years ago

I realized that my use cases don't really need the power of Rihanna, or even persistence, so I just switched to Que. The interface is almost exactly the same, so it took all of 3 minutes. I can switch back later if I need to.

Let me know if you would like any more info on this issue.