Popup appears for a fraction of a second whenever a mix task is run (verifying shm-id-F8BD8E...)

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.

Scherm­afbeelding 2024-01-22 om 12.53.21

PS: I just saw it also when opening the plain Erlang console (i.e. erl binary).

3 Likes

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.

1 Like

Here’ an Apple discussion thread that doesn’t say anything interesting: https://discussions.apple.com/thread/255428670

I’m seeing it too. Started mid last week. Got no clue what the root cause could be or how to fix it.

1 Like

I’m also seeing this, currently when (I think) ElixirLS builds in VSCode.

Versions: Running on elixir "1.15.6 (compiled with Erlang/OTP 26)" on OTP "26"

Edit: Reproducible locally by just running erl in a terminal. Erlang 26.1.1, Sonoma 14.2.1

This answer on Stack Exchange suggests that it might have something to do with asmjit.

3 Likes

Yep, but uninstalling Erlang is not an option. :confused:

I’m on an older (pre M1) Intel chip. Is everybody experiencing this in the same boat by any chance?

1 Like

I too saw the problem on an Intel mac.

1 Like

As another data point I’m not able to reproduce this issue on an ARM mac (I tested on Elixir 1.16.0 and OTP 26.2.1).

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. :frowning:

9 Likes

Thanks a lot for the clarification!

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. :smiley:

3 Likes

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.

4 Likes

Seems that the GitHub thread has concluded with the takeaway that the fix will be in OTP 27. Am I right to think this is due in May 2024?

2 Likes

Insofar as you can call using an undocumented (and unsupported) API a fix, yes. :smiley:

We also plan on disabling the JIT on x86 macs in a patch release sometime in the next few weeks.

3 Likes

That would be useful, thank you.

We are all programmers and we know it’s not a fix like a proper fix. But it will remove a prominent annoyance so yeah, it kind of sort of is a fix. :smiley:

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).

1 Like

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. :smiley:

3 Likes