Websocket disconnect and lost git info

Hi team,
I deploy theia based browser app and find thht theia webSocket often disconnects and automatically reconnects, but after reconnecting, it does not update the git information for the already opened workspace. Is this disconnection and reconnection a bug? If it is, can the git repository information be updated upon reconnection? Alternatively, is there anything I can do during the reconnection process to ensure that the git repository information is not lost?

I see this link in github issues, my situation is the same as this post, now I switch to vscode/git, see if this happens.

@qianyiliushang The reconnection issue is rather related to Git plugin issue after network disconnection · Issue #12823 · eclipse-theia/theia · GitHub.

I deploy theia based browser app and find thht theia webSocket often disconnects and automatically reconnects

Does this happen without actually losing internet connection? There might be something wrong in your reverse proxy if that is the case. Theia doesn’t drop the connection on its own.

Yes, I can see the status bar turns offline and online immediately without losing internet connection, then the git repo info lost. The local storage key theia:/archangel/:file:///projects/CDF:theia-git-selected-repository and theia:/archangel/:file:///projects/CDF:theia-git-all-repositories have empty value [].Even I refresh the browser and reload the page, the git repo never resumes. As a workround, I add an ApplicationShell and call GitRepositoryProvider.refresh({maxCount:1}) manually, after refreshing, the git repo will come back, but this leads another issue, the backend node process grows and the memory will be exausted soon, please refer this post.

The second workaround is using vscode git plugin mentioned above. I seems like there are conflicts with the thiea/git mode, I get error after refreshing browser

Promise rejection not handled in one second: Error: A filesystem provider for the scheme 'git' is already registered. , reason: Error: A filesystem provider for the scheme 'git' is already registered.
With stack trace: Error: A filesystem provider for the scheme 'git' is already registered.

I will try to comment GitRepositoryProvider.refresh({maxCount:1}) and see if this still happens.

Yes, I can see the status bar turns offline and online immediately without losing internet connection, then the git repo info lost.

Sounds like a reverse proxy issue. That’s not something Theia usually does by itself.

The second workaround is using vscode git plugin mentioned above. I seems like there are conflicts with the thiea/git mode, I get error after refreshing browser

Yes, the two ways of using Git are mutually exclusive, since they register the same providers. You’ll need to remove the @theia/git package from your app.

I don’t think this is related to reverse proxy. I run the sample form the source code, once the sample app restarts, the git repo info will never come back. Open a new private window it works fine, please refer the picture below

If I remove @theia/git, I cannot use git api such as get git brach for my custom workflow

    getCurrentBranchName(): string | undefined {
        const scmProvider = this.repositoryProvider.selectedScmProvider;
        if (!scmProvider) {
            return undefined;
        }
        const status = scmProvider.getStatus();
        if (status) {
            return status.branch;
        }
        return undefined;
    }

And I cannot use the similar api from ‘@vscode/git’