Skip to content

Error in process filter selecting deleted buffer #171

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

Closed
it6 opened this issue Jul 7, 2017 · 13 comments
Closed

Error in process filter selecting deleted buffer #171

it6 opened this issue Jul 7, 2017 · 13 comments

Comments

@it6
Copy link

it6 commented Jul 7, 2017

I noticed this error when using tide jump to definition, the file I am trying to jump to is in node_modules. Not sure if node_modules is exempt from search.

@josteink
Copy link
Collaborator

josteink commented Jul 7, 2017

Could you post more details? Some actual error-messages? Maybe some sample-code or a screenshot?

It will certainly help making it easier to track down the source of this error, and coming up with a possible fix.

@it6
Copy link
Author

it6 commented Jul 7, 2017

Here is a GIF that explains the problem.

I am on SessionService first then hit jump to definition I was able to navigate right away, then I move to ClientService and hit jump to definition which took for ever, finally when I try to navigate away from the ClientService thinking jump to definition is not working, surprisingly the jump executed and I was taken to ClientService inside node_modules.

Both SessionService and ClientService are in node_modules

Let me know if you need anything else.

jumptodefinition

@josteink
Copy link
Collaborator

josteink commented Jul 7, 2017

Thanks for the reply. That's much clearer. The GIF is really helpful.

I'll be off for vacation in around... 4 minutes, so I won't have time to look into this until I'm back, but at least I think I can say this looks more than sufficient to dig deeper into this, once I (or someone else) do have time do so.

@lddubeau: can you help out in the meantime?

@ananthakumaran
Copy link
Owner

can you enable logging and post the request/response from the tsserver for that particular action

@lddubeau
Copy link
Collaborator

lddubeau commented Jul 7, 2017

@josteink Unlikely. My personal standard for issue reports is to include a MCVE/SSCCE or equivalent. (The screenshot posted earlier does not rise to the required level.) I strive to include a MCVE in all the issue reports I submit, and I expect the same from people who submit reports to projects I am involved with.

@josteink
Copy link
Collaborator

josteink commented Jul 7, 2017

Fair enough just checking

@it6
Copy link
Author

it6 commented Jul 8, 2017

After further research

My project structure is

root
   |----src/
   |----node_modules/

At this point jump to definition works normally, most of the definitions I jump to are in node_modules

I have a gulp task which create two folders and symlinks to node_modules

Folder structure after I ran the gulp task with two new folders jit and aot
with symlinks to node_modules from the root

root
   |----src/
   |----node_modules/
   |----jit/*symlink to node_modules*
   |----aot/*symlink to node_modules*

This is when I get the following error as shown in the GIF above.

I tried adding exclude folders jit and aot to my tsconfig but the issue still persists.

I tried adding logging but I don't see any logs generated so this may not be compiler issue.

Its just inconsistently how jump to definition is working (super slow some times normal some times), I am experiencing this only in this new project, and I never saw the message error in process filter selecting deleted buffer before

@ananthakumaran
Copy link
Owner

ananthakumaran commented Jul 8, 2017

Info 206  request: {"command":"definition","seq":"663","arguments":{"file":"/Users/ananthakumaran/work/repos/TypeScript/src/server/session.ts","line":1531,"offset":51}}
Perf 207  663::definition: elapsed time (in milliseconds) 1.1577
Info 208  response: {"seq":0,"type":"response","command":"definition","request_seq":"663","success":true,"body":[{"file":"/Users/ananthakumaran/work/repos/TypeScript/src/server/session.ts","start":{"line":1036,"offset":17},"end":{"line":1036,"offset":67}}]}

@longitude The above is an example jump request/response between emacs and tsserver. If you provide the logs, it could help us narrow down the problem. Otherwise, it's difficult to figure out whether the slowness is caused by emacs or tsserver

btw, if you follow the readme the logs would be written to /tmp/tss.log

@it6
Copy link
Author

it6 commented Jul 8, 2017

Ok got it, here is the log

Info 90   request: {"command":"definition","seq":"20","arguments":{"file":"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts","line":8,"offset":14}}
Perf 91   20::definition: elapsed time (in milliseconds) 4.6354
Info 92   response: {"seq":0,"type":"response","command":"definition","request_seq":"20","success":true,"body":[{"file":"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/utilities/query-params.service.d.ts","start":{"line":2,"offset":22},"end":{"line":2,"offset":40}}]}

Two more logs

Info 117  request: {"command":"definition","seq":"29","arguments":{"file":"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts","line":7,"offset":14}}
Perf 118  29::definition: elapsed time (in milliseconds) 9.7149
Info 119  response: {"seq":0,"type":"response","command":"definition","request_seq":"29","success":true,"body":[{"file":"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/language/language.service.d.ts","start":{"line":4,"offset":22},"end":{"line":4,"offset":37}}]}

Info 168  request: {"command":"definition","seq":"42","arguments":{"file":"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts","line":14,"offset":14}}
Perf 169  42::definition: elapsed time (in milliseconds) 4.5601
Info 170  response: {"seq":0,"type":"response","command":"definition","request_seq":"42","success":true,"body":[{"file":"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts","start":{"line":1,"offset":14},"end":{"line":1,"offset":25}}]}

I notice a pattern every alternate jump to definition is slow.

@ananthakumaran
Copy link
Owner

Thanks, looks like the problem is in emacs side. Can you provide the stacktrace of the error run M-x toggle-debug-on-error and trigger the error.

@it6
Copy link
Author

it6 commented Jul 8, 2017

Here it is

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  tide-dispatch-response((:seq 0 :type "response" :command "syntacticDiagnosticsSync" :request_seq "81" :success t :body nil))
  tide-dispatch((:seq 0 :type "response" :command "syntacticDiagnosticsSync" :request_seq "81" :success t :body nil))
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-net-filter(#<process tsserver> "Content-Length: 84
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"configure\",\"request_seq\":\"78\",\"success\":true}\nContent-Length: 241
\n
\n{\"seq\":0,\"type\":\"event\",\"event\":\"configFileDiag\",\"body\":{\"triggerFile\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/theme/theme-provider.d.ts\",\"configFile\":\"/Users/kotamrs/sk/projects/myadp/tsconfig.json\",\"diagnostics\":[]}}\nContent-Length: 84
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"configure\",\"request_seq\":\"80\",\"success\":true}\nContent-Length: 109
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"syntacticDiagnosticsSync\",\"request_seq\":\"81\",\"success\":true,\"body\":[]}\nContent-Length: 108
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"semanticDiagnosticsSync\",\"request_seq\":\"82\",\"success\":true,\"body\":[]}\nContent-Length: 779
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"83\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts\",\"highlightSpans\":[{\"start\":{\"line\":8,\"offset\":3},\"end\":{\"line\":8,\"offset\":21},\"kind\":\"writtenReference\"},{\"start\":{\"line\":39,\"offset\":42},\"end\":{\"line\":39,\"offset\":60},\"kind\":\"reference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/index.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":17,\"offset\":10},\"end\":{\"line\":17,\"offset\":28},\"kind\":\"writtenReference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/utilities/query-params.service.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":2,\"offset\":22},\"end\":{\"line\":2,\"offset\":40},\"kind\":\"writtenReference\"}]}]}\nContent-Length: 128
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"84\",\"success\":false,\"message\":\"No content available.\"}\nContent-Length: 769
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"86\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts\",\"highlightSpans\":[{\"start\":{\"line\":9,\"offset\":3},\"end\":{\"line\":9,\"offset\":16},\"kind\":\"writtenReference\"},{\"start\":{\"line\":36,\"offset\":38},\"end\":{\"line\":36,\"offset\":51},\"kind\":\"reference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/index.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":15,\"offset\":10},\"end\":{\"line\":15,\"offset\":23},\"kind\":\"writtenReference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/theme/theme-provider.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":3,\"offset\":31},\"end\":{\"line\":3,\"offset\":44},\"kind\":\"writtenReference\"}]}]}\nContent-Length: 769
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"87\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts\",\"highlightSpans\":[{\"start\":{\"line\":9,\"offset\":3},\"end\":{\"line\":9,\"offset\":16},\"kind\":\"writtenReference\"},{\"start\":{\"line\":36,\"offset\":38},\"end\":{\"line\":36,\"offset\":51},\"kind\":\"reference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/index.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":15,\"offset\":10},\"end\":{\"line\":15,\"offset\":23},\"kind\":\"writtenReference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/node_modules/@espresso/core/theme/theme-provider.d.ts\",\"highlightSpans\":[{\"start\":{\"line\":3,\"offset\":31},\"end\":{\"line\":3,\"offset\":44},\"kind\":\"writtenReference\"}]}]}\n")

Another one

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  tide-dispatch-response((:seq 0 :type "response" :command "syntacticDiagnosticsSync" :request_seq "25" :success t :body nil))
  tide-dispatch((:seq 0 :type "response" :command "syntacticDiagnosticsSync" :request_seq "25" :success t :body nil))
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-decode-response(#<process tsserver>)
  tide-net-filter(#<process tsserver> "Content-Length: 221
\n
\n{\"seq\":0,\"type\":\"event\",\"event\":\"configFileDiag\",\"body\":{\"triggerFile\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts\",\"configFile\":\"/Users/kotamrs/sk/projects/myadp/tsconfig.json\",\"diagnostics\":[]}}\nContent-Length: 84
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"configure\",\"request_seq\":\"22\",\"success\":true}\nContent-Length: 221
\n
\n{\"seq\":0,\"type\":\"event\",\"event\":\"configFileDiag\",\"body\":{\"triggerFile\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts\",\"configFile\":\"/Users/kotamrs/sk/projects/myadp/tsconfig.json\",\"diagnostics\":[]}}\nContent-Length: 84
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"configure\",\"request_seq\":\"24\",\"success\":true}\nContent-Length: 109
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"syntacticDiagnosticsSync\",\"request_seq\":\"25\",\"success\":true,\"body\":[]}\nContent-Length: 108
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"semanticDiagnosticsSync\",\"request_seq\":\"26\",\"success\":true,\"body\":[]}\nContent-Length: 560
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"27\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts\",\"highlightSpans\":[{\"start\":{\"line\":14,\"offset\":10},\"end\":{\"line\":14,\"offset\":21},\"kind\":\"writtenReference\"},{\"start\":{\"line\":40,\"offset\":31},\"end\":{\"line\":40,\"offset\":42},\"kind\":\"reference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts\",\"highlightSpans\":[{\"start\":{\"line\":1,\"offset\":14},\"end\":{\"line\":1,\"offset\":25},\"kind\":\"writtenReference\"}]}]}\nContent-Length: 286
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"28\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts\",\"highlightSpans\":[{\"start\":{\"line\":2,\"offset\":3},\"end\":{\"line\":2,\"offset\":14},\"kind\":\"writtenReference\"}]}]}\nContent-Length: 109
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"syntacticDiagnosticsSync\",\"request_seq\":\"30\",\"success\":true,\"body\":[]}\nContent-Length: 247
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"semanticDiagnosticsSync\",\"request_seq\":\"31\",\"success\":true,\"body\":[{\"start\":{\"line\":12,\"offset\":47},\"end\":{\"line\":12,\"offset\":62},\"text\":\"Cannot find module '@myadp/common'.\",\"code\":2307,\"category\":\"error\"}]}\nContent-Length: 560
\n
\n{\"seq\":0,\"type\":\"response\",\"command\":\"documentHighlights\",\"request_seq\":\"32\",\"success\":true,\"body\":[{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login.component.ts\",\"highlightSpans\":[{\"start\":{\"line\":14,\"offset\":10},\"end\":{\"line\":14,\"offset\":21},\"kind\":\"writtenReference\"},{\"start\":{\"line\":40,\"offset\":31},\"end\":{\"line\":40,\"offset\":42},\"kind\":\"reference\"}]},{\"file\":\"/Users/kotamrs/sk/projects/myadp/src/modules/login/login-config.ts\",\"highlightSpans\":[{\"start\":{\"line\":1,\"offset\":14},\"end\":{\"line\":1,\"offset\":25},\"kind\":\"writtenReference\"}]}]}\n")

@ananthakumaran
Copy link
Owner

can you try master and see if it fixes the problem?

Do you have any plugin that automatically kills the buffer when you switch buffer or jump back? Still not sure why the requested buffer is not alive when the response from the tsserver is processed. Seems like a buffer is issuing command but gets killed before the response arrives.

@it6
Copy link
Author

it6 commented Jul 10, 2017

Thanks for your help I noticed an error with my project setup and fixed my tsconfig, tried your latest build it works.

The actual problem I ran into is my typescript didn't compile my project after running gulp task which created additional folders into my project.

I think this should be gracefully handle on emacs side, The error I got when compiling typescript is the exact same one as microsoft/TypeScript#17036

@it6 it6 closed this as completed Jul 10, 2017
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

4 participants