Whenever I run mix task, a popup flashes on the screen for a fraction of a second (but noticable enough to be annoying). Did anybody observe something similar. I’m running an up-to-date macOS version (Sonoma 14.1.1), and the recent versions of Elixir (1.16.0) and Erlang (26.2.1).
I’ve made a screencapture to actually be able to see it.
It contains something like verifying shm-id-F8BD8E....
This didn’t happen before, so I’m curious what started triggering this.
PS: I just saw it also when opening the plain Erlang console (i.e. erl binary).
It happens like 20 times while my OS + tools update script is running and I’m pretty confused by it as well. But no idea why is it there or how to stop it.
It’s happening to me on saving an Elixir file, so I’m guessing when LSP activates. And when I’m starting iex. Also every Erlang/Elixir compilation. I’m on an Intel Mac.
Unfortunately there’s not much we can do about this other than to have the JIT disabled by default on that configuration, and/or force people to (partially) disable the hardened runtime.
The gist of it is that x86 macs lack a certain feature that lets us safely toggle pages between being writable and executable (pthread_jit_write_protect_np), forcing us to rely on a technique known as dual-mapping where we have two different views into memory, one executable and one writable.
There’s nothing wrong with that per se, but the only way to do that on a mac is to literally create a file and mmap(2) it twice, which I’m guessing causes the popups.
I don’t think anyone is putting this on you at all. More like it’s a shame that Apple has dropped the ball so badly that mmap-ing stuff leads to UI dialogs… Which is a very strange thing to do by them.
The fun part is that using RWX pages with the hardened runtime disabled leads to no UI dialogs at all, so we’re basically being punished for trying to be more secure.
If you’re using asdf, you can workaround this issue by disabling jit by adding: export KERL_CONFIGURE_OPTIONS="--disable-jit" to your .bashrc/.zshrc before installing erlang.
Not ideal, but so much better than the popup stealing focus every few minutes for me.
I’m curious what the expected performance (or other?) side effects are when disabling JIT. Specifically for a development workstation (as I don’t this will affect production setups).
The JIT and interpreter have feature parity so the only difference should be worse performance. How much worse depends on your application, but it’s not going to be so slow as to be useless. It’s basically rolling back performance to where it was in OTP 23.
(The one exception is that the JIT has a perf integration on Linux, but that’s not relevant for Mac)
I have a hard time getting over how hacky it feels, but hey, as long as it helps.