SchildiChat / schildichat-desktop

Matrix client / Element Web/Desktop fork
https://schildi.chat
Apache License 2.0
371 stars 42 forks source link

Desktop app won't stay connected on Windows #170

Open grower-rhyme opened 1 year ago

grower-rhyme commented 1 year ago

Describe the bug SchildiChat destkop app will not stay connected on Windows 11. Upon first run, it will install and synchronize. Shortly thereafter - within a few minutes (didn't time it exactly, sorry) - it loses connection. Every subsequent launch, it will not establish a connection or sync again.

To Reproduce Steps to reproduce the behavior:

  1. Install SchildiChat on Windows 11
  2. Open it and sign in.
  3. Wait a few minutes
  4. (Optionally) restart after a few minutes.

Expected behavior SchildiChat should log in and work as expected indefinitely, including on restarts.

Other users in the SchildiChat Matrix room reported being able to recreate this bug.

Alkl58 commented 1 year ago

Same issue here. Stuck on "Cannot connect to home server. Try again ..." (translated).

Opening the dev console reveals the following: grafik

Looking at the Auth Header: grafik

Alkl58 commented 1 year ago

Another error I noticed:

grafik

and

grafik

Which leads to this Github Issue: https://github.com/vector-im/element-desktop/issues/1082

Alkl58 commented 1 year ago

When launching it from CLI, I get the following messages:

Keytar unexpected error: Error: \\?\C:\Users\Username\AppData\Local\Programs\schildichat-desktop\resources\app.asar.unpacked\node_modules\keytar\build\Release\keytar.node is not a valid Win32 application.
\\?\C:\Users\Username\AppData\Local\Programs\schildichat-desktop\resources\app.asar.unpacked\node_modules\keytar\build\Release\keytar.node
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:2039)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Username\AppData\Local\Programs\schildichat-desktop\resources\app.asar\node_modules\keytar\lib\keytar.js:1:14)
    at Module._compile (node:internal/modules/cjs/loader:1120:14) {
  code: 'ERR_DLOPEN_FAILED'
}
Seshat unexpected error: Error: error: 193\\?\C:\Users\Username\AppData\Local\Programs\schildichat-desktop\resources\app.asar.unpacked\node_modules\matrix-seshat\native\index.node
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Module._extensions..node (node:internal/modules/cjs/loader:1205:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:2039)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Username\AppData\Local\Programs\schildichat-desktop\resources\app.asar\node_modules\matrix-seshat\lib\index.js:16:22)
    at Module._compile (node:internal/modules/cjs/loader:1120:14) {
  code: 'ERR_DLOPEN_FAILED'
}

I then looked at what types those files are:

file keytar.node
keytar.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=e4f84babcb39da7424c2d0a673ccb712bc0c1ad1, with debug_info, not stripped

file index.node
index.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=786989b010f7a9e07f64319680da479b59b9605f, with debug_info, not stripped

Then I replaced those files with a working version from Element-Desktop and looking at the files again looks like this:

file keytar.node
keytar.node: PE32+ executable (DLL) (GUI) x86-64, for MS Windows

file index.node
index.node: PE32+ executable (DLL) (GUI) x86-64, for MS Windows

With this, the keytar issue disappeared, however the issue with OLM.BAD_ACCOUNT_KEY still exists

su-ex commented 1 year ago

It may help to build on Windows. The problem is, I still don't know how. Here are the attempts I've made, I didn't succeed: https://github.com/SchildiChat/schildichat-desktop/issues/117

AoiRei commented 1 year ago

I have the same problem on Windows 10. Fresh installation. Cant check the app version because clicking on "Help & About" does not do anything, but it was downloaded 2 days ago. I have an older version on my other PC with windows 10 1.7.24 and that works just fine.

Edit: just tried the 1.7.24 portable version on my fresh Win 10 installation and works fine.

Its-EGS commented 1 year ago

same here with the latest installed version

arkadym commented 1 year ago

Just did check and found only works

SchildiChat version: 1.11.8-sc.1
Olm version: 3.2.12

More fresh versions are keep losing connection. It is very simple to reproduce issue:

PS. Was bit frustrated.. We are moving from slack to matrix this week and I found Schildi much more usefull comparing to Element, thought to suggest my colleagues to use it, but then found it has such a annoying bug :( . Good to find there is a build which can work.

But now it still cannot decrypt my message in private chats. Hope it will do after awhile... Other devices are online and even tried open it. No request come for it.

arkadym commented 1 year ago

The problem i found it seems much deeper! I sent couple messages in chats from the sessions which are broken now and cannot recover. So those messages are cannot be decrypted anymore!

purplesanz commented 1 year ago

Windows 10 here. I'm trying both v1.11.8-sc.1 and v1.11.22-sc.1 (Portable). Both keep losing connection after I close them and reopen them. v1.7.24-sc1 indeed works properly.

EDIT: I just tried v1.11.4-sc.1 and it also stays connected.

arkadym commented 1 year ago

Btw, as a workaround - after setup and configure 1.11.4, then upgrade to latest, so far works fine. Seems like newer versions cannot store token properly, but once it store in settings - newer versions can use it.

purplesanz commented 1 year ago

Btw, as a workaround - after setup and configure 1.11.4, then upgrade to latest, so far works fine. Seems like newer versions cannot store token properly, but once it store in settings - newer versions can use it.

OMG, thank you so much! It works! Even clicking on "Help & About", which caused the settings page to just close before (on v1.11.22-sc.1) now works as it should. Thank you!

arkadym commented 1 year ago

Is there any chance to get it fixed ? It is already half an year nobody care it . Even I found workaround, that workaround giving another annoying issue, after upgrade from 1.11.4 - clipboard not working, I cannot paste images from clipboard. Then another issue - mentions is not working! Its just driving my crazy! I cannot use Element because lack of functions, then I cannot use Schildi because cannot paste screenshots and cannot use mentions! Today tested to build latest test release 1.11.25 and tested it on VM, it has same connectivity issue, so once I exit app and re-run - it cannot connect server anymore :(. But before I exit - tested clipboard and it works, tested mentions and it also work. But hell, I cannot exit app... Do anyone has any idea why upgrading from 1.11.4 making it not able paste images from clipboard ?

Btw, digging into problem I found settings folder Preferences file has no "device_id_salt" value on 1.11.25, could that be cause ?

su-ex commented 1 year ago

I'm not using Windows myself and I have no clue at all how to fix that. My guess is still that building on Windows might solve that (among other issues like search in encrypted rooms), but noone has ever pointed out to me how to do that.

arkadym commented 1 year ago

I'm not trying to blame you, but still. Nobody knows the product better than you. Is it such a difficult to setup VM with Windows and try ? I did my build using WSL on Windows, just because there is no guide how to make it happen on Windows. Yarn I can do. But I don't have experience with rust and not sure is there will be any other dependencies. If you could help me create build env on Windows I will try to find some time to give it a try.

su-ex commented 1 year ago

I set up a VM and tried: https://github.com/SchildiChat/schildichat-desktop/issues/170#issuecomment-1356848600 Building web is the easy part. I read it's possible to call exes out of the WSL, but I didn't succeed with WSL either yet.

su-ex commented 1 year ago

If you could help me create build env on Windows I will try to find some time to give it a try.

Btw, this is exactly what I need help for because I don't know how to.

su-ex commented 1 year ago

Just for keeping it around somewhere and not having it lost in the graveyard of Matrix history:

Attempt to build on Windows by Braid ## Requirements to build native modules Make sure to install the following tools before trying to build the native modules. They're needed. - [Git for Windows](https://git-scm.com/download/win) - [Node 16](https://nodejs.org/en) - I personally used Node 18 in my try - Python3 - Type `python` into the Command Prompt of Windows. It will open the Microsoft Store from where you can install Python3 - [Strawberry Perl](https://strawberryperl.com/) - I installed the recommended version for 64bit systems - [Rustup](https://rustup.rs/) - Windows will show a warning when trying to execute the .exe. Just click on "More information" and execute it. It's safe. Windows is just doing it's Windows thing... A command prompt will open and do it's thing after you press `ENTER`. - [NASM](https://www.nasm.us/) - I clicked on Download and installed the latest build for win64 (the installer-x64.exe) **Important:** Locate the file in your file explorer, right-click it and execute the Installer with admin privileges. Install for everyone. - Install [Cygwin](https://sourceware.org/cygwin/) - [Build Tools for VS Studio 2022](https://visualstudio.microsoft.com/de/downloads/) - I just downloaded the community edition and opened the dowloaded .exe. I then let it do its thing. After it did its thing it asked me for an update and I told it to update...Then wait...You then have a window where you can choose between "start", "change" and "more" (translation could be a bit different. Choose the one that's neither start nor more, so the one to change stuff). On the `WORKLOADS-TAB` check in the "Desktop & Mobile section" -> "C++ build tools". Could also be named something like "Desktop development with C++". After that go to the `INDIVIDUAL COMPONENTS-TAB` and check "MSVC v143 - VS 2022 C++ - x64/x68-Buildtools (Latest)". The exact version could be a bit different in the future but there should be a latest notice. Then in the same tab install "Windows 10 SDK" (the newest version). I also installed the "Windows 11 SDK", because I am on Windows 11 and it was pre-selected anyways. As the last thing you have to check "C++ CMake Tools for Windows". This was pre-selected for me. However it wasn't shown on the side, so I unchecked and rechecked it. It then was listed on the right side, too. Now click on "Intall while downloading" or something like that. Again, translation could be a bit different here. And then on "Change" so it actually starts. ![[Pasted image 20230426162147.png]] This will take a few minutes now depending on your internet connection... ## Install chocolatey and packages Install choco and choco install make and grep and sed... ## Intalling yarn This step is very easy. Just open a cmd (Command Prompt) and type: ``` npm install -g yarn ``` ## Building SchildiChat **Clone the repo** ``` git clone https://github.com/SchildiChat/schildichat-desktop.git ``` **Navigate to the cloned repo** ``` cd schildichat-desktop cd element-desktop ``` **Add Seshat for search in E2E encrypted rooms** ``` yarn add matrix-seshat ``` **Rebuild native libraries against Electron's version of node rather than your system node** ``` yarn add electron-build-env ``` **Navigate into schildichat-desktop folder ``` cd .. ``` **Install webapp** Open an instance of the git bash. This is important due to the commands not working in a normal Windows Command Prompt. Then execute ``` ./setup.sh cd element-web yarn build cd .. cd element-desktop ``` Now copy and paste the webapp folder inside schildichat-desktop/element-web to schildichat-desktop/element-desktop **Build it as described [here by Element](https://github.com/vector-im/element-desktop/blob/develop/docs/native-node-modules.md#windows)** ``` yarn run build ``` ```ad-error title: Attention This for me builds the program and gives me an Installer in element-desktop/dist with which SchildiChat also gets installed. However the installed version cannot be launched. I neither get any error when building nor when installing or starting the installed program. ```

Source: https://matrix.to/#/!eSTlitQAfqxWWEHMFD:matrix.org/$H4fMBH5sXMfCsJP9UHCU92uZDe1RWE5pLoYKffxJTFI?via=supercable.onl&via=matrix.org&via=nomadserver.us

nichu42 commented 1 year ago

Btw, as a workaround - after setup and configure 1.11.4, then upgrade to latest, so far works fine. Seems like newer versions cannot store token properly, but once it store in settings - newer versions can use it.

Thank you so much for this. It was really driving me crazy, and I thought about switching back to Element. Now uninstall, installation of 1.11.4, logging in, updating to the latest version did the trick!

Riven-Spell commented 1 year ago

I'm experiencing the same bug too on 1.11.30. The downgrade to 1.11.4, then subsequent upgrade works around this.

elydpg commented 11 months ago

I'm experiencing the same bug too on 1.11.30. The downgrade to 1.11.4, then subsequent upgrade works around this.

Same here, and on Windows 10 as well.

tbbkitty commented 11 months ago

This was an instant turn off for me, I find it difficult to believe that the devs haven't put more effort into fixing this. 'Building it on Windows' is not a fix.

Screenshot 2023-07-23 131434

Domoel commented 11 months ago

is anybody working on this problem right now? Seems like that even the mentioned workaround does not really work. At least I was dropped out today and had to downgrade to v1.11.4-sc.1 to stay connected.

SpiritCroc commented 11 months ago

is anybody working on this problem right now? Seems like that even the mentioned workaround does not really work. At least I was dropped out today and had to downgrade to v1.11.4-sc.1 to stay connected.

We need someone who is good with Windows and motivated to fight it. Of course this is a really annoying issue, but the core SchildiChat team does currently not have sufficient resources to tackle this, unfortunately.

grower-rhyme commented 10 months ago

Do y'all need a Windows machine? Serious question. Is it a lack of skill or a lack of gear? (And again, I don't mean that to be rude, I don't have any skill at all, I have just enough skill to look at code and go "yup, that's code alright" and nothing else.) If it's lack of skill, fair enough. But if it's lack of gear, I'd be willing to chip in some money toward a Windows PC for someone. Nothing fancy, no gaming laptops or anything, but I'm certain I can find you a usable Windows 11 device on clearance that's good enough for you to test and troubleshoot accordingly.

SpiritCroc commented 10 months ago

Do y'all need a Windows machine?

No, we have that, thank you for your offer.

Is it a lack of skill or a lack of gear?

Time and motivation. Or if you want to skill, while I wouldn't call it that but rather lack of time to go the hard route to acquire all the knowledge about Windows-foo, that's why we're asking for help (we still want to build Windows release ourselves ideally, but just need a good guide how one sets up an appropriate build setup for EleDesktop on Windows, which should normally be a super easy task, but somehow nobody seriously willing to try succeeded in the end, go figure). Remember, this is a hobby project, so we prefer to do what's fun to us to a certain degree. Linux tends to be fun, while Windows doesn't, at least in our eyes. It would be cool if someone could work out Windows-specific details who would also benefit from this work, as we (core team) don't benefit from it personally - no Windows in use here except for very rare occasions.

lepras commented 9 months ago

Same problems on 1.11.30-sc.2, tried both portable and install.

When you first sign in, everything works. But when you close the app and reopen:

"Connectivity to the server lost"

Tried "join the beta too", doesn't help.

I am Ok with windows let me try and fix this. 🤞

This works:

Btw, as a workaround - after setup and configure 1.11.4, then upgrade to latest, so far works fine. Seems like newer versions cannot store token properly, but once it store in settings - newer versions can use it.

So something happened thereafter, alright will investigate and let y'all know.

06000208 commented 8 months ago

Started using SchildiChat again on windows 11, started getting this. I was under the impression that the windows build was stable, but it seems like the latest build consistently stops working? Was using the setup exe from the latest release, v1.11.30-sc.2.

When it happens, my console is flooded with "rageshake.ts:74 M_MISSING_TOKEN: MatrixError: [401] Invalid Authorization header." and "Failed to load resource: the server responded with a status of 401" errors. All rooms state "Connectivity to the server has been lost.", with with the title bar stating SchildiChat is [Offline] and a red X on the icon.

Signing out and back in seems like it worked for the most part, but doing that and verifying with another login session what I can only imagine will be somewhat frequently seems like too much of a hassle.

Hope this issue can be resolved, as SchildiChat has many quality of life features over Element, and what seems like the widest support for features among matrix clients.

jriedel-ionos commented 8 months ago

Just got the same error on Linux (Arch Linux) schildichat-desktop-bin, but i'm getting the same error on element-desktop. image

Mart-Bogdan commented 3 months ago

Same on windows 10. SchildiChat version: 1.11.36-sc.3 Olm version: 3.2.14

Alos can't open Setting -> Help & About when connectivity is lost.

alrcatraz commented 2 months ago

in the latest version, this issue still exists.

Honestly, I believe most of IM app users have and use Android/IOS+Windows, and some of them have Mac, what I mean is improving the Desktop version is necessary and worth working. I really hope SchildiChat to improve and we can recommend it to friends