-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition when running two elixir scripts in the same unix pipeline #13326
Comments
Good find. We need file system locking to solve this, which is not yet available in Erlang/OTP. So we will be able to solve this only in the future. |
I run into a similar issue in ElixirLS install script. In my case the race happens when multiple editor windows are started, each one running its own LSP process. I haven't solved that yet. As a side note piping into |
In your case @kidp330 you can workaround the issue with manual |
* Bump to 0.17.0 * Workaround for elixir-lang/elixir#13326
Hello, sometimes in developer mode I get this error in my iex and I can not debug this. it is returned automatically, and breaks my iex session I am using these are same error? @josevalim
|
It seems to be something different. What is your OS and the first three lines of |
@josevalim I am very sorry, I cleaned my terminal, and I did not get this error again: My os: Intel macOs V14.3.1
but I remember this code: def create_user() do
data = fn ->
rand = randstring(10)
%{
"full_name" => "user #{generate(20) |> String.downcase()}",
"username" => generate(20),
"email" => "shahryar_#{rand}@gmail.com",
"scopes" => ["open_id", "email", "mobile"],
"devices" => ["ios", "mac"],
"status" => 4,
"roles" => [
%{"name" => "admin", "permissions" => ["admin:read", "blog:edit", "photo:read"]},
%{"name" => "user", "permissions" => ["blog:read", "photo:creat"]}
]
}
end
{time, _value} =
:timer.tc(fn ->
Enum.map(1..2500, fn x ->
case Users.create(data.()) do
{:ok, _struct} -> IO.inspect("User #{x} is created!!")
error -> IO.inspect(error, label: "User #{x} is not created!!")
end
end)
end)
time
end after That I use this 2 or 3 times
After 1 min it returned!! all process I did, returned success outputs. Thank you in advance |
@josevalim Finally I can figure out why it creates this error. When I write Persian in terminal and push the shift and a character after that delete it with Please see this Video 111.mp4Update in Elixir 1.17.0 (compiled with Erlang/OTP 27)
|
This has been solved in v1.18 as it introduces a OS lock. You can see it here:
|
Elixir and Erlang/OTP versions
Operating system
Debian 12 container
Current behavior
Scenario: I have two separate .exs scripts:
concat1.exs:
concat2.exs:
I would like to run both inside the same command, like so:
This works because they're using different caches, as you can see by the
Mix.install/2 using ...
lines.Unfortunately the process of generating a hash to use for the cache is imo not strict enough, if I delete the
system_env:
option from both scripts (or just set it to the same value) they will generate the same hash, and might fight over the cache. Example below:concat1.exs:
concat2.exs:
While the problem is less prevalent without
force: true
, it may still happen if no cache yet exists:Expected behavior
The pipeline works as in the case where the scripts have unique
system_env
's, (that is, separate cache directories).The text was updated successfully, but these errors were encountered: