Skip to content

Timeouts on querying search store #303

@katafrakt

Description

@katafrakt

On a fairly large codabase, I very often see timeouts like this in the logs:

09:15:13.016 [error] Task #PID<0.243.0> started from XPExpert terminating
** (stop) {:exception, {:timeout, {GenServer, :call, [XPEngine.Search.Store, {:exact, "JumpWeb.Admin.FeatureFlagDefinitionsLive.rollout_state_badge/2", [subtype: :definition]}, 5000]}}}
    (kernel 10.2.7.3) erpc.erl:1366: :erpc.call/5
    (xp_expert 0.1.0) lib/expert/provider/handlers/go_to_definition.ex:21: XPExpert.Provider.Handlers.GoToDefinition.handle/2
    (xp_expert 0.1.0) lib/expert.ex:121: XPExpert.handle_request/2
    (xp_gen_lsp 0.11.2) lib/gen_lsp.ex:369: anonymous fn/2 in XPGenLSP.loop/3
    (xp_telemetry 1.3.0) /Users/pawel.sw/dev/expert/apps/expert/deps/telemetry/src/telemetry.erl:324: :xp_telemetry.span/3
    (xp_gen_lsp 0.11.2) lib/gen_lsp.ex:368: anonymous fn/5 in XPGenLSP.loop/3
    (xp_gen_lsp 0.11.2) lib/gen_lsp.ex:592: anonymous fn/4 in XPGenLSP.attempt/4
    (elixir 1.19.4) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
Function: #Function<0.130722175/0 in XPGenLSP.attempt/4>
    Args: []
09:15:13.018 [error] Child :undefined of Supervisor :expert_task_queue terminated
** (exit) {:exception, {:timeout, {GenServer, :call, [XPEngine.Search.Store, {:exact, "JumpWeb.Admin.FeatureFlagDefinitionsLive.rollout_state_badge/2", [subtype: :definition]}, 5000]}}}

After seeing this, functions like go to definition and hover seem to be severely impaired in the project (although definition sometimes works, I assume by falling back to ElixirSense).

I'm seeing this for :exact, :find_by_subject and :delete_by_path.

Looking at ets.ex this corresponds to GenServer calls that do not have :infinity timeout set. Indeed, adding :infinity to all the calls inside Ets backend makes the error go away and things generally work.

However, I'm not sure it's a desirable solution. Perhaps a better approach would be to catch the timeout, return error tuple or empty results and just log the warning about timeout exceeded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions