Forums

Apparent instability of tmux, emacs daemon (invoked in terminal via ssh)

Hello Everyone,

For context: I've recently started using pythonanywhere (EU servers). I have a "Hacker" level paid account.

Among the few ways in which I have tried to do my development, one is via using emacs on the pythonanywhere (EU) servers directly. I just ran ssh in a terminal on my computer and connected to ssh.eu.pythonanywhere.com. Here, I ran tmux and within it, I run emacs etc. I run emacs as a daemon and use emacsclient to connect to it.

I've noticed over the course of a few hours of usage, that tmux and emacs daemon seem to crash now and then. I thought it might have something to do with CPU quota for the day being used up but that is not the case. I just had a crash a few minutes ago but the dashboard says CPU usage is 0% with 17 hours to go for a reset.

I was wondering if there is something odd in what I am doing or if perhaps the instability is expected. Alternately, it could of course just be an issue with the configuration on the server or a bug somewhere in the long chain of software that leads to my keystroke making a character appear on the screen.

It would be nice if I could continue using this way of development without worrying about losing some part of the "state" of my work.

I could not immediately find anything related to this upon a couple of cursory searches in the forums. If someone could point me in the right direction, it would be much appreciated.

UPDATE: I just had emacs daemon crash this time though the tmux session remained alive and well.

Cheers,

MH

How often the tmux session / emacs crash? An alternative setup I could recommend would be to use your local Emacs and set up an rsync hook to sync with your PA account (you can also open a teminal in Emacs and SSH into your account), but that would mean editing the files locally as well.

Thanks for looking into it - the emacs daemon crashes every hour or so. I didn't make any notes in detail but this is the impression I have after using it for a few hours.

Yes, I've been thinking about something like this (rsync). Upon trying, I noted that sshfs/tramp doesn't seem practical as the latency isn't pleasant. Perhaps your rsync idea will be an acceptable alternative.

However, emacs is quite stable. It's would be quite an unusual event for me if it were to crash locally on my own computer. So, there's definitely something odd going on here. Of course, I understand that among competing priorities, this might be a situation that occurs rarely (the way I'm using the pythonanywhere system). So, I would understand if it were not a high priority for you folks to dig further into it. Nevertheless, if it were to be fixed, it would be quite nice for the likes of me.

Cheers,

We can try do debug it -- I will start a similar setup to yours and check for the outcome. Meanwhile, could you tell us what is the exact command you run to start tmux (do you have any particular config?) and emacs daemon in the tmux session? I currently don't see any running processes on the ssh server matching your user. Also -- could you try starting emacs without any custom configuration (-Q flag) and / or with --debug-init flag and see if that prints anything interesting?

I've found that running emacs directly (not as daemon) seldom causes the crash. Also, it appears that tmux too is mostly fine. Running emacs in daemon mode seems to be consistently unstable.

I have made no changes at all to any emacs or tmux configs. I didn't touch those files at all.

The way I ran emacs daemon was so: emacs --bg-daemon=devs0

and connected to it via: emacsclient -s devs0 MYPROJECTFILEHERE.py

I was running this inside a tmux session started by just running "tmux" at the terminal prompt. This crashed about once an hour or so (on average, not precisely periodic).

Because of the repeated crashes, which defeated the purpose of running it as a daemon, I started running emacs in the regular way. However, soon, I'll be working on something again and will try to run the daemon with the debug-init flag and post here if it crashes again.

Cheers,

Grand! Let us know if you discover anything.

I'm afraid I could not find anything using the debug-init method. I'll try it again a few more times.

However, perhaps it's best to just forget it as on the long run, it's not practical to run/complex editing session remotely. So, I'll eventually switch away from this model as my projects grow in size and complexity.

I was not able to reproduce this behavior. The tmux session and two parallel emacs deamons have been running fine in my SSH connection with emacsclient windows open since I started them on Apr 17. I was not actively using them though, so apart from opening a dummy files and typing some chars I was not doing any other in-editor operations. I understand you use vanilla Emacs and tmux instances, correct? Is there any common pattern to when the client crashes for you?