-
Notifications
You must be signed in to change notification settings - Fork 38
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
resume from suspend requires manual refresh #287
Comments
Try this ^ change. If ok, I'll look at the libev case. |
Regarding b71faa2, I still get the same compiler error with that applied. Note that the header for libev is
I have also verified that my system version 4.33 remains the latest available (apparently from http://dist.schmorp.de/libev/) I am compiling using |
Regarding 0acfd90, the patch fixes both libevent and noevent, with the following caveats:
Typical use case is, suspend to quickly enter shell command, then Ideal behavior is, once backgrounded, the slave does not wake up until SIGCONT was received, and then does a synchronous screen refresh without waiting for a timer. |
I went back to 050f304, which was just prior to libevent code being added (2017), and elinks still has the same behavior of starting again in background shortly after suspending, so I might be remembering wrong that this behavior has changed. It would be nice if elinks didn't do this, but it doesn't seem to be a regression. |
In Does anyone know why this is done? Is this because the same code is used in master process and slave process? And master can't go to sleep without blocking all slaves? Could we have a different code path for slaves (only) that just stays asleep and doesn't fork anything? Only master needs to stay awake right? |
Ad fg) It is copied from links. It behaved like this for years and nobody complained. Ad libev) which distribution is it? |
Ok, but is there any reason we could not make slave better? At least it will be better for one user. I can try to come up with a patch. Do you see a technical reason why slave needs to be awake? I am using Ubuntu 22. |
Incidentally, I proposed the below patch in 2007, so someone did complain about it before. The original response from developers is here: https://marc.info/?l=elinks-dev&m=119638212521090&w=2 I have worked around the master needing to keep running with a master session created using
|
I don't get it. Do you want to only send continuation signal for master process? |
Ad libev) It works for me, but need to install libev-libevent-dev , which uninstalls libevent-dev. |
Yes, It works perfectly. This compromise allows me to have a headless master somewhere that is never suspended and never interacted with, while all slaves suspend and never wake up until foregrounded. The headless master continues to have existing behavior, so it should satisfy everyone. Thank you! |
The remaining issues:
As for |
Actually I noticed that the 500ms delay on resume is absent on Note, with libevent, also it does not correctly restore invoking shell screen. It starts writing at the top over the existing text on screen that was present before starting elinks. Normally (and in noevent case), screen contents at time of elinks invocation would be restored, and it starts writing where it left off at invocation time (or last suspend/resume). FYI |
There is no big difference if any (select vs libevent), so I would stay with current state. |
FYI, there is config option ui.sessions.fork_on_start . When enabled you have only slaves. |
Well, the difference is, libevent (1) requires pressing enter after ctrl-z to suspend, and (2) does not properly restore screen contents on suspend. Whether this is a "big difference" is subjective. If libevent doesn't provide any advantage over select, then I would question why it's available anyways... but the more the merrier!
Interesting, I didn't know about that. I think it will obviate my need for using I will close ticket once you make decision on whether |
The fg branch was already merged to master. |
Turns out, leaving one running headless still helps for startup overhead if there is not already an instance running somewhere. First instance to start takes a bit of time (0.36s on my system), whereas slaves connecting to existing session start instantaneously. Hence, use of |
How do you measure this? |
…n_start When ui.sessions.fork_on_start, we fork a process that has a different fdout than get_output_handle() (which has hardcoded fdout of 1), so it will never be considered term->master, yet this is the process we want to wake up in SIGTSTP handler. Since we cannot rely on term->master to determine if we are the master process, we instead move master_pid to be set explicitly at the places where we have information about whether our process is a master or a slave: first on start, then once the interlink determination has been made. master_pid has to be set in both parent and child, because both will get suspended and need to know which one needs to resume in background with SIGCONT (the master). We can't inherit from the parent because it's unknown at the time of fork. Previously, master_pid worked correctly with fork_on_start=0, -no-connect or -dump, but not with fork_on_start=1. See rkd77#287 for background.
…n_start When ui.sessions.fork_on_start, we fork a process that has a different fdout than get_output_handle() (which has hardcoded fdout of 1), so it will never be considered term->master, yet this is the process we want to wake up in SIGTSTP handler. Since we cannot rely on term->master to determine if we are the master process, we instead move master_pid to be set explicitly at the places where we have information about whether our process is a master or a slave: first on start, then once the interlink determination has been made. master_pid has to be set in both parent and child, because both will get suspended and need to know which one needs to resume in background with SIGCONT (the master). We can't inherit from the parent because it's unknown at the time of fork. Previously, master_pid worked correctly with fork_on_start=0, -no-connect or -dump, but not with fork_on_start=1. See rkd77#287 for background.
…n_start When ui.sessions.fork_on_start, we fork a process that has a different fdout than get_output_handle() (which has hardcoded fdout of 1), so it will never be considered term->master, yet this is the process we want to wake up in SIGTSTP handler. Since we cannot rely on term->master to determine if we are the master process, we instead move master_pid to be set explicitly at the places where we have information about whether our process is a master or a slave: first on start, then once the interlink determination has been made. master_pid has to be set in both parent and child, because both will get suspended and need to know which one needs to resume in background with SIGCONT (the master). We can't inherit from the parent because it's unknown at the time of fork. Previously, master_pid worked correctly with fork_on_start=0, -no-connect or -dump, but not with fork_on_start=1. See #287 for background. (cherry picked from commit b2556aa)
ctrl-z
suspend and then re-foreground, requires actrl-l
to see screen contents on resume. The following is surely the wrong fix but it works:Fix only works without libev/libevent.
ctrl-l
still required with libevent.Was not able to test with libev due to compile error:
My system has libev-4.33.
Note also,
ctrl-z
behavior with libevent is curious, it goes back to the invoking shell, but leaves elinks running in the background rather than stopped. I suppose that is a separate bug though.The text was updated successfully, but these errors were encountered: