Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow jobs block LS/RPC requests #1063

Closed
dbanck opened this issue Sep 5, 2022 · 2 comments
Closed

Slow jobs block LS/RPC requests #1063

dbanck opened this issue Sep 5, 2022 · 2 comments
Labels
bug Something isn't working performance Gotta go fast

Comments

@dbanck
Copy link
Member

dbanck commented Sep 5, 2022

This is a followup from #1050

Background

A slow-running job will block an RPC request, leading to a bad UX and lagging/slow editor. One cause for a slow-running job might be an unstable/slow network connection.

@radeksimko discovered, that we track the job ID of the module registry job (which makes a network request):

registryId, err := idx.jobStore.EnqueueJob(job.Job{
Dir: modHandle,
Func: func(ctx context.Context) error {
return module.GetModuleDataFromRegistry(ctx, idx.registryClient,
idx.modStore, idx.registryModStore, modHandle.Path())
},
Priority: job.LowPriority,
Type: op.OpTypeGetModuleDataFromRegistry.String(),
})
if err != nil {
return ids, err
}
ids = append(ids, registryId)

and wait for it to complete in the didOpen and didChange handlers:
return svc.stateStore.JobStore.WaitForJobs(ctx, jobIds...)

return svc.stateStore.JobStore.WaitForJobs(ctx, jobIds...)

This leads to blockage of the whole request until the network request is completed or timed out.

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}

module "eks" {
  source  = "terraform-aws-modules/eks/aws"
  version = "18.26.3"
}

Log Output

https://gist.github.com/dbanck/a097d77e27888bfd983412d3363c72e9

Expected Behavior

Requests should be processed fast and asynchronously

Actual Behavior

A slow job blocks the whole request and leads to suboptimal DX

Steps to Reproduce

Open the Terraform file in an editor and block/pause the language server network connections

Proposal

  • We might not need to wait for all jobs to be complete, but only for those without external dependencies.
  • In some instances (tests, performance reporting) we want to wait for all jobs
@dbanck
Copy link
Member Author

dbanck commented Apr 28, 2023

I am closing this as #1258 resolves the slow networking requests.

The remaining work is tracked in #1056

@dbanck dbanck closed this as completed Apr 28, 2023
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working performance Gotta go fast
Projects
None yet
Development

No branches or pull requests

2 participants