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

"Invalid Tab" Messages in Log #13987

Open
tsmaeder opened this issue Aug 2, 2024 · 5 comments
Open

"Invalid Tab" Messages in Log #13987

tsmaeder opened this issue Aug 2, 2024 · 5 comments
Labels
editor issues related to the editor typescript issues related to the typescript language

Comments

@tsmaeder
Copy link
Contributor

tsmaeder commented Aug 2, 2024

Bug Description:

While testing the 1.52.0 release, I found a bunch of error messages of the following for in the browser log:

bundle.js:2 Uncaught (in promise) Error: INVALID tab
    at u.acceptTabOperation (/C:/Users/thomas/AppData/Local/Programs/TheiaIDE/resources/app/lib/frontend/C:\Users\thomas\AppData\Local\Programs\TheiaIDE\resources\app\lib\backend\339.js:1:519975)
    at t.TabsExtImpl.$acceptTabOperation (/C:/Users/thomas/AppData/Local/Programs/TheiaIDE/resources/app/lib/frontend/C:\Users\thomas\AppData\Local\Programs\TheiaIDE\resources\app\lib\backend\339.js:1:522339)
    at /C:/Users/thomas/AppData/Local/Programs/TheiaIDE/resources/app/lib/frontend/C:\Users\thomas\AppData\Local\Programs\TheiaIDE\resources\app\lib\backend\366.js:1:35962
    at process.processTicksAndRejections (VM1720 task_queues:95:5)
    at async c.handleRequest (/C:/Users/thomas/AppData/Local/Programs/TheiaIDE/resources/app/lib/frontend/C:\Users\thomas\AppData\Local\Programs\TheiaIDE\resources\app\lib\backend\638.js:1:46979)

Errors in tab tracking are more relevant than they may appear because the typescript language server relies on tracking the active tab to decide which files to error check, for example.

Steps to Reproduce:

n/a

Additional Information

  • Operating System: Windows 11
  • Theia Version: 1.52.0 preview
@tsmaeder tsmaeder added editor issues related to the editor typescript issues related to the typescript language labels Aug 2, 2024
@tsmaeder
Copy link
Contributor Author

I was able to reproduce the issue in the electron sample app, but only after working for a couple of hours. The editor I closed was a new file, I believe.

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Aug 15, 2024

I added some debug logging and it seems the invalid tab messages always come from TabOperation.UPDATED operations, which get invoked upon the Title.changed signal.

{
   "kind":2,
   "index":-1,
   "tabDto":{
       "id":"11~code-editor-opener:file:///c%3A/Users/thomas/code/theia/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts:1",
       "label":"tab-bar-toolbar-registry.ts",
       "input":{
           "kind":1,
           "uri":{
               "$mid":1,"path":"/c:/Users/thomas/code/theia/packages/core/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar-registry.ts",
               "scheme":"file"
           }
       },
       "isActive":false,
       "isPinned":false,
       "isDirty":false,
       "isPreview":false
   },
   "groupId":11
}

@tsmaeder
Copy link
Contributor Author

I suspect the -1 index comes from tabs-main.ts#updateTabIndices#349. It's the only place I could find where -1 might be set as the index.

@tsmaeder
Copy link
Contributor Author

tsmaeder commented Aug 15, 2024

I was able to catch the moment the -1 index happens in the debugger. It happened when I was closing a tab: The situation was as follows:

  • Open Tabs: promise-util.ts | lib.es5.d.ts | tab-bar-toolbar-registry.ts | tab-bar-toolbar.tsx | tab-bar-toolbar-types.ts | widget.d.ts
  • Tab being closed was "lib.es5.d.ts"
  • In updateTabIndices, the tabInfo is the tab being closed (lib.es5.d.ts),
  • the tab being updated is tab-bar-toolbar-registry.ts
  • tab.group.tabs at this point contains twice the tab for tab-bar-toolbar.tsx instead of tab-bar-toolbar-registry.ts | tab-bar-toolbar.tsx

=> so the tabInfo.group.tabs values are already corrupt that this point. Not clear whether the structure has been rebuilt or if it was corrupted incrementally.

@tsmaeder
Copy link
Contributor Author

Since I did not move any tabs, I think the duplicat tab must come from tabs-main.ts#onTabTitleChanged(), there, it says:

if (!this.tabDtosEqual(oldTabDto, newTabDto)) {
            tabInfo.group.tabs[tabInfo.tabIndex] = newTabDto;

What if tabInfo.tabIndex is not the same as the previous index in the group? Is that even possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor issues related to the editor typescript issues related to the typescript language
Projects
None yet
Development

No branches or pull requests

1 participant