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

clipcatd stops watching clipboards with error? #20

Closed
jonaz opened this issue Mar 24, 2021 · 18 comments
Closed

clipcatd stops watching clipboards with error? #20

jonaz opened this issue Mar 24, 2021 · 18 comments

Comments

@jonaz
Copy link

jonaz commented Mar 24, 2021

It works for a while and then it stopps working. I ran it with '--no-daemon` to see the error when it stops working:

Mar 24 08:10:52.941  INFO Clipboard ["https://certbot.eff.org/instructions"]
Mar 24 08:10:52.941 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Clipboard) is closing
Mar 24 08:10:52.941  INFO Primary ["https://certbot.eff.org/instructions"]
Mar 24 08:10:52.941 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Primary) is closing
@Icelk
Copy link

Icelk commented Mar 24, 2021

Hi @jonaz ! I suspect this has to do with #19

Have you restarted xorg or your window manager while clipcatd was running. If so, just restart the daemon.

Hope it helps

@jonaz
Copy link
Author

jonaz commented Mar 24, 2021

I have not restarted X11.

I have restarted i3 with bindsym $mod+Shift+r restart to load new config.

But now i tried that a few times and the error did not occur when $mod+Shift+r

I guess clipcatd always try to reconnect to clipboard whatever happens.

@Icelk
Copy link

Icelk commented Mar 24, 2021

Weird, it works for me, using i3-msg restart which should do the exact same thing.

Try clearing your clipboard cache and see if the issue persists.

@jonaz
Copy link
Author

jonaz commented Mar 24, 2021

Yeah it works for me during restart of i3. So something else is causing this bug.

@Icelk
Copy link

Icelk commented Mar 24, 2021

Could you include your config?

Are all the socket ports the same in all the configs?

Did you try clearing the cache? clipcatctl clear IIRC

@jonaz
Copy link
Author

jonaz commented Mar 24, 2021

$ cat clipcatctl.toml 
server_host = '127.0.0.1'
server_port = 45045
log_level = 'INFO'


jonaz@work ~/.config/clipcat  
$ cat clipcat-menu.toml 
server_host = '127.0.0.1'
server_port = 45045
finder = 'rofi'

[rofi]
line_length = 100
menu_length = 30

[dmenu]
line_length = 100
menu_length = 30

[custom_finder]
program = 'fzf'
args = []

jonaz@work ~/.config/clipcat  
$ cat clipcatd.toml 
daemonize = true
max_history = 5000
history_file_path = '/home/jonaz/.cache/clipcat/clipcatd/db'
log_level = 'INFO'

[monitor]
load_current = true
enable_clipboard = true
enable_primary = true

[grpc]
host = '127.0.0.1'
port = 45045

Error happened again. is there any debug flags to clipcatd?

Mar 24 10:16:41.931 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Primary) is closing
Mar 24 10:16:42.153  INFO Clipboard ["DRIF-6553"]
Mar 24 10:16:42.153 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Clipboard) is closing
Mar 24 10:58:02.639  INFO SIGINT received!

@Icelk
Copy link

Icelk commented Mar 24, 2021

I presume you can change log_level = 'INFO' to log_level = 'DEBUG' to increase verbosity.

Again, have you tried to remove all cache files at /home/jonaz/.cache/clipcat/clipcatd

@jonaz
Copy link
Author

jonaz commented Mar 24, 2021

I presume you can change log_level = 'INFO' to log_level = 'DEBUG' to increase verbosity.

Again, have you tried to remove all cache files at /home/jonaz/.cache/clipcat/clipcatd

Yes. how would that have helped technically? The problem is not with the database. the problem is what the log said?

@jonaz
Copy link
Author

jonaz commented Mar 24, 2021

Tried again with log_level TRACE and still errors after a while and it stopps working:
Mar 24 15:12:23.109 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Primary) is closing
Mar 24 15:12:23.109 ERROR Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Clipboard) is closing

@Icelk
Copy link

Icelk commented Mar 24, 2021

Weird.

Might look into the code tomorrow.

@ffernand
Copy link

I have the exact same error as OP. I've started using clipcat today but noticed that for the second time today it fails after a while.

Jun 10 15:07:47 chorus clipcatd[130504]: gRPC service listening on 127.0.0.1:45045
Jun 10 17:08:29 chorus clipcatd[130504]: Failed to load clipboard, error: Unexpected Reply type: 0, ClipboardMonitor(Clipboard) is closing

There doesn't appear to be any rhyme or reason... My window manager is i3wm, and I'm running my clipcatd daemon in the systemd user space. I hadn't restarted i3.

~/.config/clipcat/clipcat-menu.toml

server_host = '127.0.0.1'
server_port = 45045
finder = 'rofi'

[rofi]
line_length = 59
menu_length = 20

[dmenu]
line_length = 100
menu_length = 30

[custom_finder]
program = 'fzf'
args = []

~/.config/clipcat/clipcatd.toml

daemonize = true
max_history = 50
log_level = 'INFO'
history_file_path = '.cache/clipcat/clipcatd/db'

[monitor]
load_current = true
enable_clipboard = true
enable_primary = false

[grpc]
host = '127.0.0.1'
port = 45045

cat ~/.config/clipcat/clipcatctl.toml

server_host = '127.0.0.1'
server_port = 45045
log_level = 'INFO'

I'm running ArchLinux and using the AUR package provided by https://aur.archlinux.org/packages/clipcat/

$ clipcatd --version
clipcatd 0.5.0

$ cat ~/.config/systemd/user/clipboard.service
[Unit]
Description=Clipcat the Clipboard Manager
PartOf=graphical-session.target

[Service]
ExecStart=/usr/bin/clipcatd --no-daemon

[Install]
WantedBy=xsession.target

I don't think I can report anymore than what @jonaz has already shared. But as a fallback until this is fixed... if we can cause the service to die, then I can get systemd to restart the service and carry on.

@ffernand
Copy link

I've been able to reproduce the issue reliably and consistently whenever I copy a url from the address bar in Google Chrome.

I can copy anything else in Google Chrome without issue, but the service will stop if I copy any part of the url from the address bar.

As a hack, I had modified monitor.rs to exit with error-code == 1 whenever the ClipboardMonitor error reveals itself.

diff --git a/src/monitor.rs b/src/monitor.rs
index 535f924..a77e2dc 100644
--- a/src/monitor.rs
+++ b/src/monitor.rs
@@ -168,7 +168,7 @@ fn build_thread(
                         err,
                         clipboard_type
                     );
-                    return;
+                    std::process::exit(1);
                 }
             }
         }

With the systemd service file now having the Restart=on-failure flag, as soon as it restarts clipcatd will read in the last item on the clipboard -- which ends up copying the url successfully anyways.

Besides this little hiccup... absolutely loving Clipcat!!!

@Icelk
Copy link

Icelk commented Jul 28, 2021

I've made a fork which fixes this problem.
https://github.com/Icelk/clipcat

@Filip62
Copy link

Filip62 commented Aug 2, 2021

Also experiencing this. @xrelkd If by chance you find some time and motivation, please look into this. Would 100% use this over anything else.

@magnetophon
Copy link

I've made a fork which fixes this problem. https://github.com/Icelk/clipcat

@Icelk Thanks a lot for your work!
Since this repo has been inactive for a while, would you mind enabling issues on your repo?

@Icelk
Copy link

Icelk commented Dec 26, 2022

@magnetophon Great idea! It's done. Thanks for your interest.

@wrvsrx
Copy link

wrvsrx commented Jan 7, 2023

@ffernand @jonaz It's a bug caused by require clipboard content from x11 only by utf8-string instead of string. I have made a PR fix to Icelk's folk.

@xrelkd
Copy link
Owner

xrelkd commented Dec 1, 2023

The component which listens to X11 has been re-written, clipcat does not depend on x11-clipboard now.
In the newer release, https://github.com/xrelkd/clipcat/releases/latest, Clipcat tries to re-connect X11 after losing the connection.

@xrelkd xrelkd closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants