zachallaun
Hi friends,
I’m working on a contribution to Finch and am having a hell of a time debugging an unexpected process exit that’s causing a test to fail.
The code being tested is rather unfinished and very much a work-in-progress, but I wanted to have a baseline before I start refactoring and moving things around. When the test reaches the call to cancel the async request, the test fails (not immediately, but after a very small period), with the following message:
Things I’ve tried so far:
- Re-creating the issue without using Finch (I couldn’t)
- Running the code outside of the context of a test (it works as expected)
- Creating the process with a Task supervisor (what’s currently in the code)
- Creating the process with
Task.async - Creating the process with
spawn - Various exit trapping
I have a hunch this has something to do with ExUnit’s GenServer, but I’m really struggling to find more information and I’m at a loss for how to debug further.
Trending in Questions
Hello everyone!
I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++.
Does anyone ...
New
I’m very new to Elixir, so sorry if this is a silly question:
I am wondering what happens to the mailbox of a process when the machine i...
New
How do I tell Hologram not to escape HTML when substituting into templates?
{Textile.render(@product.long_description)}
escapes the HTM...
New
Background
When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error:
* assembling mark...
New
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New
Other Trending Topics
Hey there,
I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first.
...
New
Hi everyone :waving_hand:
I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly)
AI dream has many faces, but general...
New
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex











Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
The message looks a lot like the symptom from this issue:
https://github.com/PSPDFKit-labs/bypass/issues/120
This could be happening when the
Taskterminates while still waiting for a reply from Bypass, causing the Bypass process to crash and taking the test process down along with it.You could try trapping exits in the test and calling
receiveexplicitly to see what’s bubbling up.Another thing to try: add a sleep for longer than the sleep in the
Bypass.expectblock to the very end of the test, so that the Bypass process is definitely finished before the test ends.zachallaun
That looks really promising. I cloned Bypass and changed the dep to a local path-based one and then tried fixing the line referenced in that issue and removing it altogether, both to no avail. It does seem likely that it’s taking down the Bypass server somehow.
hkrutzer
Maybe
sysdebug can help? Debug tracing · Elixir Recipeszachallaun
That was a good idea.
So it looks like Bypass is sending an exit shutdown message to what I presume to be the test server. I’m not entirely sure why or what I can do to prevent it.
Edit: Looking at the code, it’s Bypass that’s exiting here.
Edit 2: And, indeed, if I modify Bypass to not exit at that line, the test works.
pcruz
I know it’s a bit late, but I have also encountered this problem, and I was able to resolve it by calling the
Bypass.downfunction before the end of the test:I hope this helps someone in the future.
RudManusachi
Bypass.down(bypass)for us didn’t work.However, what works is “overriding” the
on_exitfor the bypass so that it doesn’t try to verify the expectations.Some notes on my investigation:
In order to reproduce the issue we could do the following:
Basically the idea is to simulate that in the code, despite being asynchronous, actually makes the request that reaches out Bypass server.. But the test exits prior to the Bypass sending the response and. And since the test exists it shuts down Bypass!
However,
Bypass.open()prematurely setson_exitcallback where it makes a synchronousGenServer.callto Bypass to verify all its expectations. And the state of Bypass at that moment is erroneous:exit, :shutdownthat’s being raised.Knowing those details, I didn’t really want to comment that line in the Bypass source, since I think it’s still valuable for
Bypass.expect(when the request was made, but test finishes prior to Bypass responding.. though the error could have been better, but in that case the developer might want explicitly synchronize the test with Bypass maybe by some message passing andassert_receive)I made this patch but I thing it’s not as reliable as overriding
on_exitcallback.. since forBypass.stubthere should be no verification of expectations.. at lieast not on the number of requests