Open jsermeno opened 2 weeks ago
Is ElixirLS's debugger executing any code from stream_data? Otherwise, I don't see how this could be cause by stream_data itself 😕
Hi, thanks for getting back so quickly. Yes, the code executes StreamData code unless I'm missing something. The greets the world
test executes and calls the gen_data_all()
function which calls the gen
macro from the ExUnitProperties module in order to generate test data.
test "greets the world" do
data = Enum.at(gen_data_all(), 0)
assert ElixirLsFailure.hello() == :world
end
This is the code from StreamData that seems to cause the issue:
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
Right, I’m confused as to why this would only show up in ElixirLS but not in normal code. It seems to be an issue with ElixirLS, is what I’m trying to say.
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:
Removing 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 anotherfixed_map
call.Related issue here: https://github.com/elixir-lsp/elixir-ls/issues/1017