absinthe
absinthe copied to clipboard
Compilation infinite loop leaking memory
Environment
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.15.4 (compiled with Erlang/OTP 25)
$ grep absinthe mix.lock
"absinthe": {:hex, :absinthe, "1.7.4", "97e37622fad63997afff96ee5aaaad42ea9150f5d5aa5783a05c61374734cc90", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 1.2.2 or ~> 1.3.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:opentelemetry_process_propagator, "~> 0.2.1", [hex: :opentelemetry_process_propagator, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "4d5cf4cd0c44e9d7b11d56bf112721e48cce1a7d04dd461c616a99eedbf1c69b"},
"absinthe_error_payload": {:hex, :absinthe_error_payload, "1.1.4", "502ff239148c8deaac028ddb600d6502d5be68d24fece0c93f4c3cf7e74c1a4d", [:make, :mix], [{:absinthe, "~> 1.3", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, "~> 3.1", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "9e262ef2fd4a2c644075e0cdde2573b1f713c0676ab905c8640eaa8a882b2aca"},
"absinthe_graphql_ws": {:hex, :absinthe_graphql_ws, "0.3.6", "0de5b1cba1940fabcf6d63c99eb2ad574f95c1415f5128d5b4b6814e7a3eab5f", [:mix], [{:absinthe, "~> 1.6", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_phoenix, "> 0.0.0", [hex: :absinthe_phoenix, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}, {:markdown_formatter, "~> 0.5", [hex: :markdown_formatter, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "ad5e51a17cda917fdb70c1ec4e1d93fbad57edd4f5da4de2a62694b4738fa439"},
"absinthe_phoenix": {:hex, :absinthe_phoenix, "2.0.2", "e607b438db900049b9b3760f8ecd0591017a46122fffed7057bf6989020992b5", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:absinthe_plug, "~> 1.5", [hex: :absinthe_plug, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.5", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.13 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}], "hexpm", "d36918925c380dc7d2ed7d039c9a3b4182ec36723f7417a68745ade5aab22f8d"},
"absinthe_plug": {:hex, :absinthe_plug, "1.5.8", "38d230641ba9dca8f72f1fed2dfc8abd53b3907d1996363da32434ab6ee5d6ab", [:mix], [{:absinthe, "~> 1.5", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bbb04176647b735828861e7b2705465e53e2cf54ccf5a73ddd1ebd855f996e5a"},
"absinthe_relay": {:hex, :absinthe_relay, "1.5.2", "cfb8aed70f4e4c7718d3f1c212332d2ea728f17c7fc0f68f1e461f0f5f0c4b9a", [:mix], [{:absinthe, "~> 1.5.0 or ~> 1.6.0 or ~> 1.7.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "0587ee913afa31512e1457a5064ee88427f8fe7bcfbeeecd41c71d9cff0b62b6"},
Expected behavior
Compilation successful or raises an error
Actual behavior
Compilation stuck with Compiling lib/app_web/api/schema.ex (it's taking more than 10s)
until consumes all available memory and gets killed by OOM
Relevant Schema/Middleware Code
I would like to share the details if you can point to what can I share. I have a huge and private gql project where this is happening, and I just don't know what should I share. The diff which breaks the code has introduced a few unions, objects, enums and one import_types
and relay connection without anything special
Oh, I've found the root cause. It happens when you add import_types
into the module where you import types from, and not in the schema, where it is supposed to be used in
@benwilson512 why did you close it as completed? Reopen please
@benwilson512 ping
Hi @hissssst sorry when you indicated that you found the root cause I took that to mean that you had solved the issue. Are you asking Absinthe to detect such cases proactively and raise an error?
Yes, exactly. This is even in the issue
Expected behavior Compilation successful or raises an error