skyjake / lagrange

A Beautiful Gemini Client
https://gmi.skyjake.fi/lagrange/
BSD 2-Clause "Simplified" License
1.19k stars 62 forks source link

Flatpak sandbox requires D-Bus for IPC (unable to launch v1.3 due to leftover .pid file) #245

Open Altonss opened 3 years ago

Altonss commented 3 years ago

Lagrange crashed and now doesn't launch anymore. I am running Lagrange 1.3.1 from Flathub on Fedora 33. Do you know why this happened and how to fix this issue? Thanks for your help !

skyjake commented 3 years ago

Perhaps this is due to issue #243?

The fix for that is in v1.3.2 that I've submitted just now to Flathub. It should be up soon.

If it still crashes with v1.3.2 we'll need to try some troubleshooting.

Altonss commented 3 years ago

It just updated to 1.3.2, but Lagrange just doesn't open :(

skyjake commented 3 years ago

Well, let's first see if clearing the stored runtime state (tabs, etc.) helps.

Find the file state.lgr somewhere under the ~/.var/app/fi.skyjake.Lagrange/ directory and rename the file. When you launch Lagrange, all previously open tabs should be gone.

If it still crashes after this, do the same with prefs.cfg. That will reset your preferences to the defaults.

Altonss commented 3 years ago

Find the file state.lgr somewhere under the ~/.var/app/fi.skyjake.Lagrange/ directory and rename the file. When you launch Lagrange, all previously open tabs should be gone.

What name should I choose to rename the file?

skyjake commented 3 years ago

It could be state.lgr.old for example. The actual name doesn't matter as long as it's different so Lagrange doesn't use it.

Altonss commented 3 years ago

I renamed state.lgr, it didn't work. Then I renamed prefs.cfg but it doesn't work neither.

skyjake commented 3 years ago

All right, try launching the app from the command line like this:

flatpak run fi.skyjake.Lagrange -E

What does it print?

Altonss commented 3 years ago

I get this: tabs.new

skyjake commented 3 years ago

I see. That indicates Lagrange's IPC mechanism has a problem when running inside the Flatpak sandbox. Do you have an instance of Lagrange already running?

Check for a hidden .pid file in ~/.var/app/fi.skyjake.Lagrange/config/lagrange/ and delete it.

Altonss commented 3 years ago

Thanks it works now ! Do you know why this happened?

skyjake commented 3 years ago

This seems to happen if 1) you already have the app running, or 2) the app crashes/was killed and it didn't clean up after itself.

To fix this I'll need to figure out how to check for previously launched app instances under Flatpak, where the sandbox permissions seem to prevent them directly communicating with each other.

Altonss commented 3 years ago

Thanks for your help and explenations. I will not close the issue if it's a bug that needs to be fixed.

skyjake commented 3 years ago

Yes this does need to be addressed...

Since Flatpak supports D-Bus, that is probably the way to go here. The drawback is that we'll have to use the low-level C API directly since Lagrange does not rely on higher-level UI frameworks like GTK.

skyjake commented 3 years ago

v1.3.3 is available on Flathub with the IPC feature disabled (reverting to v1.2 behavior), so now it should allow launching multiple instances. However, they will overwrite each other's data, so for example newly added bookmarks might get lost.