Skip to content

Commit 36c2787

Browse files
author
José Valim
committed
Immediately shutdown the lexical tracker
Otherwise we may have a race condition if the code is passing __ENV__ to an eval function which may keep the lexical tracker if it is alive by the time it is checked.
1 parent 2bafa0b commit 36c2787

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/elixir/lib/kernel/lexical_tracker.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule Kernel.LexicalTracker do
3333

3434
@doc false
3535
def stop(pid) do
36-
:gen_server.cast(pid, :stop)
36+
:gen_server.call(pid, :stop)
3737
end
3838

3939
@doc false
@@ -146,6 +146,10 @@ defmodule Kernel.LexicalTracker do
146146
{:reply, :maps.get(key, cache), state}
147147
end
148148

149+
def handle_call(:stop, _from, state) do
150+
{:stop, :normal, :ok, state}
151+
end
152+
149153
def handle_cast({:write_cache, key, value}, %{cache: cache} = state) do
150154
{:noreply, %{state | cache: :maps.put(key, value, cache)}}
151155
end
@@ -206,10 +210,6 @@ defmodule Kernel.LexicalTracker do
206210
{:noreply, %{state | directives: add_directive(state.directives, module, line, warn, :alias)}}
207211
end
208212

209-
def handle_cast(:stop, state) do
210-
{:stop, :normal, state}
211-
end
212-
213213
@doc false
214214
def handle_info(_msg, state) do
215215
{:noreply, state}

0 commit comments

Comments
 (0)