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

Receiving unexpected tsserver messages in server logs #291

Open
benjreinhart opened this issue Sep 14, 2024 · 5 comments
Open

Receiving unexpected tsserver messages in server logs #291

benjreinhart opened this issue Sep 14, 2024 · 5 comments

Comments

@benjreinhart
Copy link
Contributor

I have noticed a lot of tsserver messages in the logs recently that indicate we are still connected to a tsserver instance after we should have shut it down. I'm not exactly sure why this is happening but I didn't use to see these.

Received a response for command 'open' and request_seq '0' but no resolver was found. This may be a bug in the code.

Response:
{
  "seq": 0,
  "type": "response",
  "command": "open",
  "request_seq": 0,
  "success": true,
  "performanceData": {
    "updateGraphDurationMs": 379.10445799999997
  }
}

Received a response for command 'open' and request_seq '1' but no resolver was found. This may be a bug in the code.

Response:
{
  "seq": 0,
  "type": "response",
  "command": "open",
  "request_seq": 1,
  "success": true
}

Received a response for command 'open' and request_seq '2' but no resolver was found. This may be a bug in the code.

Response:
{
  "seq": 0,
  "type": "response",
  "command": "open",
  "request_seq": 2,
  "success": true
}
@Sanjoy-droid
Copy link
Contributor

hey @benjreinhart can you please elaborate how to reproduce this issue?

@benjreinhart
Copy link
Contributor Author

@Sanjoy-droid I'm not sure the exact cause, but it happens very regularly for me. If you navigate between a srcbook, the home page, another srcbook, add/delete them, etc, I would expect you to come across this unless there's something unique going on in my environment.

@BeRecursive22
Copy link
Contributor

@benjreinhart it's not your environment. I was able to reproduce it and the cult is "React's StrictMode". Once you disable it, the ts server will stop normally and you won't see those logs.

I am still not confident why it's happening. Maybe double invoking messes up with the lifecycle and hence the cleanup effect not running properly.

Anyways even with StrictMode enabled, we can just stop the ts server in a separate useEffect.

@Sanjoy-droid let me know if this worked.

@BeRecursive22
Copy link
Contributor

@benjreinhart or you can assign the issue to me for a deeper look.

@BeRecursive22
Copy link
Contributor

@benjreinhart @nichochar
NOTE: Potential Resource Leak

  • There was a risk of CPU/Memory leak if a user opened a Srcbook,
  • navigated to other routes, and remained there indefinitely.
  • The tsserver processes would continue running in the background,
  • potentially consuming system resources unnecessarily.

I haven't dive deeper into the backend code but I hope we have a server-side timeout mechanism to stop inactive tsserver processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants