-
-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Hi,
I've run into an issue that seems to be caused by an interaction between this library and the ElixirLS debugger. In a brand new project with no dependencies besides StreamData, debugging will hang and the beam.smp process will continue to increase in memory. It takes a few seconds to reach 10-20GB. If you let it run for 10 minutes or so it will exhaust all memory on your system.
System: Macbook Pro M3 Max 16"
OS: MacOS Sonoma 14.1
Minimal reproduction of the error: https://github.com/jsermeno/elixir_ls_debug_failure.
The offending lines of code seem to be:
defmodule ElixirLsFailureTest do
use ExUnit.Case
doctest ElixirLsFailure
use ExUnit.Case
use ExUnitProperties
def gen_data() do
StreamData.list_of(StreamData.fixed_map(%{
"e" => StreamData.string(:utf8)
}), min_length: 1, max_length: 1)
end
def gen_data_all() do
gen all fixed_map <- gen_data() do
fixed_map
end
end
test "greets the world" do
data = Enum.at(gen_data_all(), 0)
assert ElixirLsFailure.hello() == :world
end
endRemoving most any StreamData calls from this test case fixes the error for me and debugging continues to work normally. The issue seems to occur from the debugging interpreting the StreamData module while running this code. This means using :int.ni/1 or :int.i/1. Avoiding interpreting the StreamData module avoids this problem.
The original context for this piece of code is that StreamData.list_of() was generating values inside of another fixed_map call.
Related issue here: elixir-lsp/elixir-ls#1017