-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Termux is randomly closing / loosing sessions #122
Comments
This has now started to occasionally occur occasionally on my server termux (which houses my IRC client and an IRC bot) as well. This device didn't do anything special. No foldersync, no jekyll. Sadly, I had to switch back to using an Ubuntu box as server for now. Termux was perfect for the job as small, personal, home server due to low energy use and no noise emission. The Xperia Z is still running Android 5, which is weird, because the problem has only started happening on my Z3C after the marshmallow upgrade. |
I have some interesting new observations about this: It has been happening exactly the same time these past 4 days. It's always at 09:10 exactly. For 4 days now termux has closed at 09:10. Since it's connected to my PC I notice pretty quickly. My Phone is doing nothing special at this time. I am not using foldersync anymore. It's just plugged into my PC. So either this is caused by something that runs at the same time every day or is caused exactly 24 hours after Termux starts. This Problem is so weird and elusive. |
The same here that Termux runs quite well for several days, then suddenly quits. Android 7.1. |
I haven't had this issue in a long time. I think it is just a simple Memory problem. I no longer use any syncing apps (doing it in termux now) and it doesn't really happen anymore. But I have some sort of test case here:
I think my original problem was simple the Memory usage of FolderSync killing Termux. But is there anything that can be done that would result in high Memory usage commands like the above one (or an intensive Jekyll build) to always lead to state If nothing can be done about |
Did you solve this yet? |
I don't have much of a problem on my 2gb ram LG Android 7 phone, but my 1gb ram LG Android 5 phone closes apps all the time now. If I want to be sure the session doesn't end, I can't multitask much at all. Apps just take more ram, now. Having extra internal storage seems to help, possibly with some kind of virtual memory... |
I'm seeing Termux randomly stop running on a Samsung SM-J727U (Android 8.1) as well, but so far I've only seen it happen when the phone is left alone to charge for some time. I haven't had it happen when running on battery and actively using the device, including running multiple apps at the same time, etc. I have no idea what the connection is. Disabling the system app power monitoring service and adding Termux to the whitelist makes no difference. And what's odd is that when after this happens and I come back and restart Termux, it then often crashes when I try to open the extra keys view (Volume Up+Q) |
I do rarely have termux close abruptly on the Android 7 device when left alone for a while, not including when the app updates. It happens to other apps too, though. |
@Quasic So you have exactly same behaviour as in #122 (comment) ? Without knowing which signal is sent to the shell, it is not possible to know what happens. If PS. I never had this issue on all my devices. |
That comment link doesn't seem to work for me for some reason, but it only happens very rarely for any app in particular, and sometimes may not happen at all for weeks, (unless I happen to clear it after it happens without checking the Activity.) I don't know if I'll be able to find the logcat entry without logging it all while charging, but I assume that because termux seems no more affected than other apps, it is a system thing. I just actually cleared termux from recent apps, and it restored where I left off when relaunched. |
I'm not sure if my issue is exactly the same as the original described one, but in my case the only time I've seen Termux unexpectedly quit was when I left my device to charge fully; and this behavior is pretty consistent. I haven't been able to catch exactly when the quit happens, though. It's not immediately but seems to be either after some time of charging like an hour or two, or perhaps even around the time the battery reaches full. I don't have a rooted device, but I do seem to be able to access logcat from ADB (but not dmesg). Maybe next time I'll try to see if any clues show up. |
Same problem with Sony Xperia M (not tested on others). Most of the day at work bettercap and records events in a sniffing file. Session falls occur at night. The phone is usually on charge. Your phone's settings like everyone else, syncing with google turned on. |
I have the same problem on LineageOS 14.1 and the notification also disappears. It sometimes closes while my phone is charging overnight. I think it should at least automatically restart like Tasker does when killed. My SSH server would then restart without me having to reopen Termux manually. |
same problem on my Huwaei mate 10 lite (4gb ram). |
Ok I've just figured it out. |
@houcemlaw I had this setting with termux and it still was stopped/killed. |
So I've finally noticed an interesting pattern to this in my particular case (Termux runs fine unless left on charge for a while, then it mysteriously stops, and it has nothing to do with battery-saving functions in the OS): It seems to be related to Android's/Google's device backup feature. I tried disabling the cloud backups in Google settings completely, and the next two times I left the device charging, Termux kept running without a problem when it would have definitely stopped. Then I turned the backups back on and waited a day or two, and sure enough, it went back to dying. So I get a strong impression that Termux is dying for some reason when the Google backup service attempts to back the app up. Other apps don't seem to have this issue. Since people here seem to be reporting symptoms that may have different causes, should I post a separate issue for this particular case? |
@ticalc-travis Termux has enabled support for Google backup. However, I'm not sure whether it is properly configured. In https://github.com/termux/termux-app/blob/master/app/src/main/res/xml/backupscheme.xml we have:
which means to backup Probably better to use backup path |
Looks like Termux really gets killed when Google backup is working. Just reproduced it with starting manual backup in device settings. Google backup doesn't work reliably. It backed up folder Better to disable this feature and Termux will no longer be stopped when it is running. |
May Be phone system trying to close background process of termux , i face same problem in my phone its close connection after certain period of time. |
This damn issue is still happening for no reason. Recently I started using termux on a HUAWEI P9 Lite which has android 7, before using termux on that phone I was using a android 5.1, and it worked fine. Then termux started from no where to close which annoyed me. I am running a discord bot on this phone which makes it harder to make it 24/7. I tried disabling backups by Google services, and I monitored my phone hours, and when I went to sleep, after half an hour or more, it stopped randomly.. When I discovered this I was beyond annoyed anymore. I just ran it one more time before going to sleep. Today again I found out that termux closed again. Any any ANY ideas? |
@Cristy86 Probably a battery saving or high memory usage protection feature. A logcat would help to see more precisely why termux is killed. You can run It is probably a huawei specific issue: #1172 |
Right. I disabled some of the battery saving features and I will see if that's the case. |
This comment has been minimized.
This comment has been minimized.
... My termux shuts down after 5min after i background it, or as soon as i start using something that it's running while in the background(for example visiting a website that it's hosting) and it's fine as long as i'm on the app but really annoying when i'm not. also it's on a android 9 phone |
The Android 5 phone that used to close it all the time now keeps the sessions very well. The only thing I really changed was taking it off of cell service. I assume it freed enough RAM to let more apps run at the same time. |
You can try my workaround described here #1172 (comment) and see whether it works for your device (I had to apply the workaround for huawei mate9 with that default emui stuff on it). |
Hi, this has been talked about on #termux quite a bit, a while ago. But I'm opening an issue here, because it still affects me (on 3 different phones) and so it doesn't get forgotten and because it is quite severe.
On my phones, Termux would randomly close. This happens mostly in the middle of the night (on 2 out of 3 nights), but it has also happened multiple times while I was working with it over SSH.
Possible causes
FolderSync
At night my phone is running a few FolderSync tasks. There aren't a lot of files to be synced, but it does check a lot of files. I've checked and FolderSync isn't using up Memory or CPU.
Jekyll
In the cases of it closing while I'm working with it, it has happened noticably more frequent when working with Jekyll, while Jekyll is generating the website.
Speculation
It seems to happen during times of high filesystem activity. Is it maybe related to a filesystem interrupt? Like a file that needs to be read by the app which it can't do because the filesystem is overloaded?
All this happens with or without Wakelock held. Termux isn't entirely closing, it just seems to loose the session. The following screenshot shows "0 terminal sessions" and the Wakelock isn't held. As far as I know, Termux should only show 0 Sessions when a Wakelock is held.
I also once made termux do a continous logcat until it closed. https://gist.github.com/Neo-Oli/faa32ecb939c1f88cbcd7748a8377600
So far, this has only happened on marhmallow phones. It first appeared the day after I upgraded from KitKat.
Sadly, I can't produce a reproducible test case that doesn't involve waiting for 12 hours. I'm hoping someone else has the same issue as me. I'd be willing to run any test builds or do any debugging I can.
The text was updated successfully, but these errors were encountered: