LSylvester
Hey guys,
I’m currently using Poolboy to manage a pool of AMQP connections. In my unit tests, I have some that kill connections to test the service comes back. However, Poolboy dishes out dead connections because the kill in the actual connection module takes a while to bubble up to the GenServers terminate function. I’m following the advice given for AMQP, but it just isn’t working out.
Is there a decent solution to this?
Thanks,
Lee
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
fishcakez
I can’t quite understand your setup but you can prevent poolboy giving the worker to the next process by monitoring the worker and waiting for the
:DOWN.GenServer.stopof the worker will provide this guarantee. This works because poolboy is link’ed to the worker processes, and exit signals are sent before monitor signals. Therefore poolboy is guaranteed to have the exit signal in it is message queue before process receives the:DOWN. This means poolboy will handle the exit signal first and replace the worker.LSylvester
That’s what I’m doing now. So, I have a pool which has many workers. Each worker is a GenServer with a Connection in its state. If I kill the connection and put the worker back, then manage to check it out again soon after, the worker hasn’t yet had its
:DOWNhandler called, and so the next process to use it crashes.LSylvester
What would be really nice is if Poolboy checked for a particular function in the worker, such as an
is_ready()function, where the server could check if the Connection objects PID was alive and returntrueorfalse. That would solve the issue, I think.fishcakez
That isn’t quite the same as what I said. I said monitor the worker and wait for that go to
:DOWN.fishcakez
Would poolboy be making a call to the worker? If the worker is busy this blocks the pool waiting on a single worker. This could be prevented by having the worker do the checkin instead of the calling process. However then the worker needs to do the monitoring instead of poolboy, and the worker needs to know about poolboy, and suddenly everything is different. I have a library that follows a similar pattern: GitHub - fishcakez/sbroker: Sojourn-time based active queue management library · GitHub but by making some hard problems easier it also makes some easy problems harder. I would not recommend it unless it can solve a problem that a simpler solution can not.
darnahsan
I might. be facing the same issue in my application, did you get to a solution for this @LSylvester