PragTob
![]()
Hey everyone,
ever since the introduction of profiling into Benchee the test suite has experienced flakiness.
We basically call the built-in tasks like this Eprof task in Elixir.
Now, with 40 build configuration running, quite often we get a failure like this one:
1) test hooks all kinds of hooks with inputs work (Benchee.ProfileTest)
Error: test/benchee/profile_test.exs:164
** (exit) exited in: :gen_server.call(:eprof, {:profile_start, [], {:_, :_, :_}, {:erlang, :apply, [#Function<6.45063716/0 in Benchee.Benchmark.Runner.main_function/2>, []]}, [set_on_spawn: true]}, :infinity)
** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
code: retrying(fn ->
stacktrace:
(stdlib) gen_server.erl:223: :gen_server.call/3
Warning: (mix) lib/mix/tasks/profile.eprof.ex:197: Mix.Tasks.Profile.Eprof.profile_and_analyse/2
(mix) lib/mix/tasks/profile.eprof.ex:186: Mix.Tasks.Profile.Eprof.profile/2
Warning: (benchee) lib/benchee/benchmark/collect/profile.ex:17: Benchee.Benchmark.Collect.Profile.collect/2
(benchee) lib/benchee/benchmark/runner.ex:291: Benchee.Benchmark.Runner.collect/3
Warning: (benchee) lib/benchee/benchmark/run_once.ex:15: Benchee.Benchmark.RunOnce.run/3
(elixir) lib/enum.ex:783: Enum."-each/2-lists^foreach/1-0-"/2
Warning: (elixir) lib/enum.ex:783: Enum.each/2
(benchee) lib/benchee/profile.ex:59: Benchee.Profile.profile/2
Warning: (ex_unit) lib/ex_unit/capture_io.ex:151: ExUnit.CaptureIO.do_capture_io/2
(ex_unit) lib/ex_unit/capture_io.ex:121: ExUnit.CaptureIO.do_capture_io/3
Warning: test/benchee/profile_test.exs:166: anonymous fn/0 in Benchee.ProfileTest."test hooks all kinds of hooks with inputs work"/1
(benchee) test/support/test_helpers.ex:17: Benchee.TestHelpers.retrying/2
Warning: test/benchee/profile_test.exs:165: (test)
Which is weird, as the elixir code explicitly starts eprof (yes even in 1.9.4, I double checked, those are lines 196-197):
:eprof.start()
:eprof.profile([], fun, Keyword.get(opts, :matching, {:_, :_, :_}))
Some thoughts:
- Now you could assume cross test taint but the test file under question runs with
async: false. - The return values of
:eprof.start()are also basically “started correctly” or “I was already started, here is my pid” so I don’t think checking these would help eprof — OTP 29.0.2 (tools 4.2.1) - It seems to happen mostly with eprof, but that might be because eprof is our default profiler.
- rerunning a failed run with the same seed also works (I was worried that a specific order of tests might crash eprof or something but since we start it again
)
Basically I’m at wits end. I now started retrying these tests (finally correctly
) but that also doesn’t feel right. I hope I’m just missing something stupid, which I’d be happy for y’all to tell me about ![]()
If anyone had any idea why these keep failing I’d be happy to hear them and fix it for real ![]()
Thanks!
Tobi
PS: cc @pablocostass if you have any idea ![]()
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
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
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
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
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
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
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
It doesn’t seem likely, but what about a race between one test’s
:eprof.stopactually deregistering the process and the next test’s:eprof.startchecking for that registration?That could result in
:eprof.startreturning{:error, {:already_started, PID}}with a PID that is already stopping.PragTob
(sorry for the late response)
That seems like a good idea. I had hoped that
:eprof.stop()was sync/waited for all to finish but maybe it isn’tThe docs say nothing about it being sync or async, however the type signature makes it look like it’d be sync
stop() -> stoppedI’ll check it out, thanks!
PragTob
Unless I’m missing something it all looks really sync to me although I’m not sure in which order exactly GenServer itself handles stuff…
al2o3cr
My reading -
stop()will return when the GenServer replies, which is done right after callingterminate:https://github.com/erlang/otp/blob/09c601fa2183d4c545791ebcd68f869a5ab912a4/lib/stdlib/src/gen_server.erl#L1191-L1196
but the name won’t be deregistered until the GenServer’s process exits.
PragTob
Interesting - thank you!
So, checking and waiting in case the process isn’t shut down at the end of the test might solve it - I’ll give that a shot.
Unless you got any other ideas which I’d be happy to hear.
Thank you very much