lanoxx / tilda

A Gtk based drop down terminal for Linux and Unix
GNU General Public License v2.0
1.28k stars 161 forks source link

"The keybinding you chose for "Pull Down Terminal" is invalid." #82

Closed cofi89 closed 9 years ago

cofi89 commented 10 years ago

Hi, I've been getting this error for quite some time, with no apparent cause/reason ( unless I'm missing the obvious, which quite possibly might be the case :grinning: ).

Although it doesn't happen to often, it's still quite annoying because besides losing the keybinding, Tilda loses the entire configuration, so everything needs setting up again. I checked the config file while the error window is still displayed, and it's completely empty, as you can see in this screenshot: tilda-config

It happens randomly, right after log in and doesn't seem to be distro/DE specific. Fedora 20 LXDE, Zorin 6 Lite ( 'buntu 12.04, also LXDE ), elementaryOS, TRIOS Xfce ( debian Jessie )...all the same.

Also, it doesn't make any difference leaving the default, or setting up different key or key combo...

If there is any more info I can provide you with, please let me know.

Cheers!

bnkr commented 10 years ago

I get this when tilda starts up twice for some reason. I guess this is because the session manager saved tilda at one point but it is also in the list of start up programs. The workaround is either to tell the session manager to ignore tilda or to remove it from the startup list.

It would be good to have tilda behave as a single-instance program -- I'm pretty sure it always used to (except when loading with a different config). I remember some talk about locking code somewhere in a recent refactor, so maybe this is a new bug, lanoxx?

cofi89 commented 10 years ago

I can confirm that it does indeed happen when second instance is started. However, it does make sence when XFCE is considered, since it does session saving, and I have Tilda in autostart, but likely not so for LXDE/Openbox ( I know that lxsession can save sessions, but as far as I know, it doesn't do that by default, or does only in Lubuntu ) .

Anyway, in my (xfce) case right now, it ain't part of the saved session: [filip@trios][~/.cache/sessions]$ dir thumbs-trios:0 xfce4-session-trios:0 Thunar-24505f6d9-49cd-4e90-9864-6cd746a2a9dd xfce4-session-trios:0.bak [filip@trios][~/.cache/sessions]$ cat xfce4-session-trios\:0 | grep tilda [filip@trios][~/.cache/sessions]$

I'll check both xfce session and process list, next time when the error occurs, and let you know if it is indeed a second instance that is the cause.

Cheers! :smiley:

lanoxx commented 10 years ago

It seems there is a race condition with the lock files if tilda starts twice in a row with very little time in between. Then the lock file has not been written yet but the instance number for the second instance is already being calculated. I am currently not sure how this can be fixed.

cofi89 commented 10 years ago

Unfortunately, I can't be of much help with that, since I have no usable knowledgde of C, but I've been thinking, as a workaround/temporary fix, maybe use a shell script to start tilda, instead of binary itself?

Renamed the binary to "tilda-main", and used "tilda" script to launch it, either immediately, or with a delay if allready running.

tilda(.sh):


#!/bin/bash

if [ "$(pidof tilda-main)" ] then echo "Allready running, will wait a bit, then launch second instance" && sleep 3 && tilda-main else tilda-main fi


And that seemed as a nice idea, until I tested it. Result: same "keybinding" issue, only 3sec later :grinning: I guess that the second instance is trying to use the config file of the first one ( or copy of it ), resulting in the keybinding conflict. And most importantly, 3 or 30 or 300 sec delay makes no difference, there will always be keybinding error thrown!!!

So, hopefully helpfull idea: For the users that need/use multiple instances, maybe the best thing to do would be to add a "if running" check, which would:

  1. Make each instance use it's own config file, using the process age to determine order ( eg first one to start uses config_0, second uses config_1 etc... ), and if needed, delay consecutive execution to prevent issue with the lock file. Then:
  2. If there is no config file for n instance, instead of throwing keybinding error, show a dialog informing the user that the n-th instance is about to be started, and present a choise to either start it ( and proceed to configuration dialog if needed ) or cancel. Including "Remember my choice".

And for people who only need single Tilda, simply add an option to disable multiple instances. :wink:

For users: In the meantime, a quick fix is to use a script for autostarting and preventing second instance. As root, create "tilda-autostart" where you see fit ( I've placed it in /usr/bin ) and put the following in it:


#!/bin/bash

if [ "$(pidof tilda)" ] then : else tilda fi


then make it executable, and add it to your autostart ( including the path, if it's not in /usr/bin ). :beers:

lanoxx commented 10 years ago

I think this issue is caused by some wrong flags when creating the lock files. Tilda is using g_create which default to: O_CREAT|O_WRONLY|O_TRUNC but actually O_CREAT|O_WRONLY|O_EXCL would be needed. I will try to write a fix and see if my assumption is correct.

lanoxx commented 10 years ago

I have pushed a fix for the locking issue, but it is not a simple fix. I would like to get some feedback before merging it into the master branch as soon as possible. If this works for everybody then I will make it into master.

If you have time, please test the fix and report back. Thanks a lot.

cofi89 commented 10 years ago

Lookin' good over here :smile: :+1: Killed the running instance, removed the debian package, compiled &: [filip@trios][~/Builds/tilda-master]$ tilda & tilda & tilda & tilda [1] 12412 [2] 12413 [3] 12414 [4] 12415 Tilda has started. Press F2 to pull down the window. Tilda has started. Press grave to pull down the window. Starting the wizard to configure tilda options.Tilda has started. Press F3 to pull down the window. Starting the wizard to configure tilda options.Tilda has started. Press F5 to pull down the window. Tilda has started. Press F4 to pull down the window.

There were two existing config files @~/.config/tilda. As you can see, both are loaded properly, and for the other two (new) instances Config dialog launched.

So far so good! If anything new pops up, I'll let you know. Many thanks!!!

cofi89 commented 10 years ago

Bummer, got "invalid keybinding" on startup again :disappointed:

Everything is the same as before, empty config_0, signle instance in the process list, and Tilda is not part of the saved XFCE session.

[filip@trios][~/.cache/sessions]$ cat xfce4-session-trios\:0 | grep tilda
[filip@trios][~/.cache/sessions]$ 
[filip@trios][~/.cache/sessions]$ ps -ef | grep tilda
filip     1456     1  0 19:43 ?        00:00:00 tilda
filip     1955  1728  0 19:55 pts/1    00:00:00 grep tilda
[filip@trios][~/.cache/sessions]$ 
[filip@trios][~/.cache/sessions]$ pgrep tilda
1456
[filip@trios][~/.cache/sessions]$ 
[filip@trios][~/.cache/sessions]$ cat ~/.config/tilda/config_0
[filip@trios][~/.cache/sessions]$ 

.xsession-errors is not of much help either:

(tilda:1456): GLib-GObject-WARNING **: The property GtkSettings:gtk-cursor-blink is deprecated and shouldn't be used anymore. It will be removed in a future version.

(tilda:1456): GLib-GObject-WARNING **: The property GtkSettings:gtk-cursor-blink-time is deprecated and shouldn't be used anymore. It will be removed in a future version.

(tilda:1456): GLib-GObject-WARNING **: The property GtkSettings:gtk-cursor-blink-timeout is deprecated and shouldn't be used anymore. It will be removed in a future version.

I'm really running out of ideas where to look. For now I changed the command in autostart entry so it logs the output. Maybe something usefull shows up.

tilda > >(tee /home/filip/tilda-stdout.log) 2> >(tee /home/filip/tilda-stderr.log >&2)

Let me know if there is anything else to look at.

lanoxx commented 10 years ago

Sorry to hear that. If you can reproduce this again please let me know. I am quite sure that the locking issue should be fixed, maybe you have discovered another bug.

gjroelofs commented 9 years ago

I've got the same problem over here (Arch Linux, Openbox). I'm sure it's not starting twice though, and no session being recorded.

(Tilda is only started in Openbox autostart, with a delay) The problem is that the settings being lost seems to happen randomly, with no apparent cause.

cofi89 commented 9 years ago

I've discovered a mistake I made in autostart command. It didn't catch any error output on startup. :disappointed:

Anyway, this one is correct ( double checked ):

bash -c "tilda 2>&1 | tee -a /home/user_name/tilda-errors.log"

I'll post the log as soon as "keybinding" failes. For now, I got only this:

Tilda has started. Press grave to pull down the window.

(tilda:1459): Gdk-WARNING **: tilda: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

Tilda has started. Press grave to pull down the window. 

Also, please reopen this issue if possible, as it doesn't seem to be related to locking.

cofi89 commented 9 years ago

Allright, finally some results. Not quite as expected, but anyway...

(tilda:6836): Gtk-WARNING **: Theme parsing error: gtk.css:73:1: Expected a valid selector
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Tilda has started. Press (null) to pull down the window.

That's what was caught in the log, when "keybinding error" popped.

Here's the entire log:

Tilda has started. Press grave to pull down the window.

(tilda:1459): Gdk-WARNING **: tilda: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

Tilda has started. Press grave to pull down the window.

(tilda:7616): Gdk-WARNING **: tilda: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

Tilda has started. Press grave to pull down the window.

(tilda:6836): Gtk-WARNING **: Theme parsing error: gtk.css:73:1: Expected a valid selector
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Tilda has started. Press (null) to pull down the window.

(tilda:1376): Gtk-WARNING **: Symbolic icon list-remove-symbolic-ltr of size 16 is in an icon theme directory of size 96

(tilda:1376): Gtk-WARNING **: Symbolic icon list-add-symbolic-ltr of size 16 is in an icon theme directory of size 96

(tilda:1376): Gtk-WARNING **: Symbolic icon list-remove-symbolic-ltr of size 16 is in an icon theme directory of size 96

(tilda:1376): Gtk-WARNING **: Symbolic icon list-add-symbolic-ltr of size 16 is in an icon theme directory of size 96
Tilda has started. Press grave to pull down the window.
gondorf commented 9 years ago

I'm getting this issue too on Arch. I autostart, and it gives me the keybinding error occasionally.

lanoxx commented 9 years ago

Hi,

I will reopen this issue since. I agree that there seem to be two issues here, one was the locking which I have fixed, but it seems there is another problem. Although at the moment I have no clue what it could be. I assume the problem that the config file gets somehow corrupted either when tilda is closed or when it is started, can you let me know if the config file has a size of 0 when this issue appears?

@cofi89 I have an idea. Could you modify your start script to list the contents of ~/.config/tilda and write it to your log. Do that before you start tilda and after the command terminates. This would give us a clue if the config file was corrupted by the last tilda process or if its being corrupted during the start of tilda. I'm thinking of something like:

ls ~/.config/tilda | tee -a /home/user_name/tilda-errors.log
bash -c "tilda 2>&1 | tee -a /home/user_name/tilda-errors.log"
ls ~/.config/tilda | tee -a /home/user_name/tilda-errors.log

I haven't tested this so you might need to tweak it a little.

cofi89 commented 9 years ago

I've looked into that on multiple occasions, it is zero in size every time when the issue appears ( "config_0" to be more precise ).

@ idea :+1: This should do it:

bash -c "echo -e '\n-------LS-Before-------\n' >> /home/filip/tilda-stderr.log; ls -l ~/.config/tilda/ | tee -a /home/filip/tilda-stderr.log; echo -e '\n-------STARTUP--------\n' >> /home/filip/tilda-stderr.log; tilda 2>&1 | tee -a /home/filip/tilda-stderr.log; echo -e '\n-------LS-After-------\n' >> /home/filip/tilda-stderr.log; ls -l ~/.config/tilda/ | tee -a /home/filip/tilda-stderr.log"

:pray: ( I guess I've created a monster :grin: )

Update:

"Monster" is behaving. Here's what I'm getting logged ( no issue appearing this time ):

-------LS-Before-------

total 12
-rw-r--r-- 1 filip filip 2194 Jan 29 23:28 config_0
-rw-r--r-- 1 filip filip 2193 Dec 30 23:15 config_1
-rw-r--r-- 1 filip filip 2188 Sep 23 23:30 config_2

-------STARTUP--------

Tilda has started. Press grave to pull down the window.

(tilda:3702): Gdk-WARNING **: tilda: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

-------LS-After-------

total 12
-rw-r--r-- 1 filip filip 2194 Jan 29 23:28 config_0
-rw-r--r-- 1 filip filip 2193 Dec 30 23:15 config_1
-rw-r--r-- 1 filip filip 2188 Sep 23 23:30 config_2

-------LS-Before-------

total 12
-rw-r--r-- 1 filip filip 2194 Jan 29 23:28 config_0
-rw-r--r-- 1 filip filip 2193 Dec 30 23:15 config_1
-rw-r--r-- 1 filip filip 2188 Sep 23 23:30 config_2

-------STARTUP--------

Tilda has started. Press grave to pull down the window.
cofi89 commented 9 years ago

Got it. :+1: Running "ls" doesn't do it's job when shutting down the PC ( although that might be related to xfce session saving, I'll test it on LXDE machine )... Anyway, even without "LS-After" confirming it, looks like config file gets cleared up during shutdown, not during startup:

-------LS-Before------- #(OK ↓ )

total 12
-rw-r--r-- 1 filip filip 2194 Jan 29 23:28 config_0
-rw-r--r-- 1 filip filip 2193 Dec 30 23:15 config_1
-rw-r--r-- 1 filip filip 2188 Sep 23 23:30 config_2

-------STARTUP--------

(tilda:1634): Gtk-WARNING **: Theme parsing error: gtk.css:72:24: Failed to import: Error opening file: No such file or directory
Tilda has started. Press grave to pull down the window.
g_dbus_connection_real_closed: Remote peer vanished with error: Underlying GIOStream returned 0 bytes on an async read (g-io-error-quark, 0). Exiting.

-------LS-Before------- #( NOPE ↓ )

total 8                   # ↓
-rw-r--r-- 1 filip filip    0 Feb  5 23:10 config_0
-rw-r--r-- 1 filip filip 2193 Dec 30 23:15 config_1
-rw-r--r-- 1 filip filip 2188 Sep 23 23:30 config_2

-------STARTUP--------

(tilda:1619): Gtk-WARNING **: Theme parsing error: gtk.css:72:24: Failed to import: Error opening file: No such file or directory
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Tilda has started. Press (null) to pull down the window.
cofi89 commented 9 years ago

Yep, xfce-session is getting in the way. No problems with LXDE.

If anybody else uses my startup command to get Tilda output logged on XFCE, move the command from xfce autostart, to a separate sh script ( eg. ~/tilda-autostart ). Make it executable and add it to xfce autostart.

#!/bin/sh

bash -c "echo -e '\n-------LS-Before-------\n' >> /home/user_name/tilda-stderr.log; ls -l ~/.config/tilda/ | tee -a /home/user_name/tilda-stderr.log; echo -e '\n-------STARTUP--------\n' >> /home/user_name/tilda-stderr.log; tilda 2>&1 | tee -a /home/user_name/tilda-stderr.log; echo -e '\n-------LS-After-------\n' >> /home/user_name/tilda-stderr.log; ls -l ~/.config/tilda/ | tee -a /home/user_name/tilda-stderr.log" &

With that, ~/.config/tilda will be ls'd, and output logged when you power off/reboot/log out...

piotrberlowski commented 9 years ago

Hi guys, I've been experiencing this issue for years now and it's good to see it being worked on. So my use case is that I run 2 tilda on startup:

[pberlowski@computer ~]$ cat bin/tilda-startup 
( ( tilda & ) && sleep 3 && ( tilda & ) ) &

I guess that with the locking issue gone I can remove the sleep in between the startups :)

With regards to tilda nuking its config, my .config/tilda directory looks like this:

[pberlowski@computer ~]$ ls .config/tilda/
config_0  config_0.bak  config_1  config_1.bak

Periodically tilda just truncates either config_0 or both _0 and _1. I then just restore from backup...

I never managed to catch or understand the exact circumstances of this happening, but I'll try to narrow it down. It seems to me that it mostly occurs in case of unclean shutdowns.

Hope this adds meaningfully to the discussion?

lanoxx commented 9 years ago

I pushed another patch today that might help fix this issue: f36e57aa2d971e580eefb8f26533bc9e2b655b00

Also this is related to issue #155

cofi89 commented 9 years ago

@lanoxx Great, will test. :smiley:

By the way, I've written a starter script recently as a workaround. In the nutshell it checks conf files for size, and if some is found to be zero bytes it's restored from backup, after wich Tilda is started. It can also create backups, start multiple instances ( with 1s sleep in between, so should work for older versions ), and logs all actions ( including Tilda's stdout/stderr ).

So people using Tilda from their distro repoes ( ~v1.1 ) can use it until it's fixed for good.

More info & download: https://github.com/cofi89/tilda-starter

lanoxx commented 9 years ago

This would not be difficult to backport to 1.1 (just need to cherry-pick the commit), the bigger question is if distros will accept this as a stable release update. I have written my sponsor for the Debian package upload a mail and asked about this. Lets see what he writes me back.

Please let me know if you can still reproduce the issue once you hat time to test my patch.

cofi89 commented 9 years ago

:+1: @ distro's Fingers crossed. Although it's a tiny and, FWIK, quite simple patch, so I guess it should be acceptable... Btw, there's also a option of making a release here on Github, including packages, if you would consider that.

Anyway, compiled and running latest git. I'll report should nuking happen again ( hopefully not & might take some time, since it's hard to reproduce at will ).

piotrberlowski commented 9 years ago

To be honest, I'll try to build and install locally. It's not hard to reproduce at all. It happens on every second shutdown for me :)

cofi89 commented 9 years ago

For me it's totally random. Sometimes happens 2-3 times in a row, sometimes even two months pass in between.

If it's of any importance, that is on my main distro, TRIOS ( Debian Jessie ) with lightdm, complete xfce, systemd. It's the same with the main edition running sysvinit+openrc ( I was once thinking that it may be the crazy shutdown speed of systemd that might be adding up to the issue, but from what I've seen so far, it seems irrelevant ).

Also, regularity is similar on other distros that I use sometimes ( Manjaro Pekwm/Ubuntu Mate/Salix XFCE ).

andresmaiden commented 9 years ago

I have the same issue in Ubuntu 15.04 64bits. I will help you if you need something to test, I use Tilda a lot.

lanoxx commented 9 years ago

This should be fixed in Tilda 2.0.4 I am not sure if Ubuntu already pulled that update from Debian.

andresmaiden commented 9 years ago

Ubuntu repositories have Tilda 1.2.2, I can send an email to Ubuntu to ask them to pulled the new Tilda.

lanoxx commented 9 years ago

Sorry I mixed up the digits in my last post. The latest version is 1.2.4 not 2.0.4. The fix appeared first in 1.2.3 so both 1.2.3 or 1.2.4 should fix it. From my experience Ubuntu usually does not pull minor bug fix releases into their released versions. You will probably need to wait until the next Ubuntu.

cofi89 commented 9 years ago

Just to report back, it seems to bi fixed for good. Besides the probably irrelevant fact that I'm still running ~June 26th git version, I didn't get the error since ( any error for that matter ). :+1: :smiley:

lanoxx commented 9 years ago

Cool. Thanks for the reply. I'm going to close the issue then.

hembrasalvaje commented 8 years ago

hi everyone, in the last few days i have just and this come up in ubuntu mate 15.04. tilda is playing up and wishing i knew how to fix it. it is the keybindings again. any suggestions?

lanoxx commented 8 years ago

Which version are you running?

hembrasalvaje commented 8 years ago

i upgraded from the previous version of ubuntu mate to 15.04. otherwise standard

cofi89 commented 8 years ago

v1.2.2 is in 15.04. Keybinding is fixed in 1.2.3 and later.
So you can:

  1. Compile 1.2.4 ( https://github.com/lanoxx/tilda/archive/tilda-1.2.4.tar.gz ),
  2. Install 1.2.4 from 15.10 ( download .deb from here http://packages.ubuntu.com/wily/tilda ),
  3. Or use a script I've written for starting Tilda ( use it to launch/autostart instead of calling Tilda directly ). https://github.com/cofi89/tilda-starter

Personally, I'd try 15.10 package first. If it fails to install due to dependencies, purge it first, then compile and install manually.

LinuxOnTheDesktop commented 5 years ago

As someone wrote above:

It would be good to have tilda behave as a single-instance program

As things stand, I've had all sorts of strange and seemingly hard to control behaviour - multiple instances, ending up configuring one version of Tilda when I want to configure another, Tilda when run on startup not showing up, the 'invalid keybinding' bug. I am unsure how much of this is by design. Sometimes I end up with an instance of Tilda placed right on the desktop, immune to super-d - just what I want; but there other instances running at the same time and it's chaos.

qdouasbin commented 4 years ago

I had a similar issue due to the fact that the locks (in ~/.config/tilda/locks in Ubuntu 20.04) are not deleted when the machine restarts with closing Tilda instances beforehand. Manually deleting the locks is a pain and I think it is a scary solution for newbies.

Could an instance of Tilda check if other instances are running and, if not, delete the locks?