-
Notifications
You must be signed in to change notification settings - Fork 53
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
scrot -f -s -
hangs and freezes the X server after selection
#402
Comments
Can't reproduce with with a 1080p resolution. Are you sure c60a26c is the culprit? Does it work before that commit? But in any case, the current |
Also when testing, try explicitly testing both |
I just tested again and it seems that Also, I can confirm it's |
scrot -f -s
hangs and freezes the X server after selectionscrot -f -s -
hangs and freezes the X server after selection
I have updated the title to match my observation. |
Okay, thanks. I'm still not sure why that commit in specific would be causing this issue.
Does writing to a file work (e.g If writing to a file works, then can you also test piping that file into xclip afterwards? E.g: scrot -fs - >/tmp/shot.png
cat /tmp/shot.png | xclip ... (Note, I'm using Also please provide the full xclip command you're using. |
Writing to a file works for some reason. Direct stdout output (just direct |
Okay. Weird.
I tried this out and took a 1080p shot and it worked fine. My xclip & X version: $ xclip -version
xclip version 0.13
$ X -version
X.Org X Server 1.21.1.16
X Protocol Version 11, Revision 0 Are you using linux or some other OS? Maybe test out the v2 branch if you have sufficient version of imlib2, it contains some "fixes" to stdout handling. |
1080p also (mostly) works fine for me, however my monitor is at 3072x1920. Maybe try taking something bigger? It's inconsistent too, maybe try filling your screen up with random patterns that maximizes the output image size?
Yes, I'm on Linux. Unfortunately v2 still has the same problems, but it does seem to work more and hang less for some reason. The thing is, I don't know if this is related to CPU cache or something (my knowledge of hardware is super limited), but the more I use scrot, the less likely it hangs, so it is really hard to test everything out. |
Also, in the meantime, I guess I'll just go with |
If it's inconsistent, then are you sure that it's c60a26c causing the issue and that you didn't just get lucky when trying the older commit?
My monitor isn't any bigger :)
If this also hangs then the issue is almost certainly with |
I was going to say that you can also use Hooking into the hanged process with gdb, I see that it's hanged in here: Line 636 in 6345b81
This means that stdout has nothing to do with the issue. I think it maybe due to the ungrab request not being flushed?? Does the following patch solve the issue for you? For me it seems to fix the problem, I can't trigger it anymore. diff --git a/src/scrot_selection.c b/src/scrot_selection.c
index 1bb55db..d860e7b 100644
--- a/src/scrot_selection.c
+++ b/src/scrot_selection.c
@@ -451,8 +451,10 @@ Imlib_Image scrotSelectionSelectMode(void)
Imlib_Image capture = scrotGrabRectAndPointer(
rect0.x, rect0.y, rect0.w, rect0.h, opt.freeze);
- if (opt.freeze)
+ if (opt.freeze) {
XUngrabServer(disp);
+ XFlush(disp);
+ }
if (opt.selection.mode == SELECTION_MODE_CAPTURE)
return capture; |
scrot compiled from that commit onwards has a 70% or something chance to hang for me when I try to take a fullscreen screenshot. For the older commit I tried doing the same thing 20 times, and couldn't trigger anything. So I'd say I'm pretty sure here.
Unfortunately no. I tried patching both the master and v2 branch and they all trigger the hang for me. On a second note, I also tried |
That's not the correct patch. The XFlush needs to be added after XUngrabServer call, not Grab. |
OK I don't know how I misread your patch, but after applying the correct one the problem is gone, or at least, I can't trigger it any more. Should we close this issue then? |
otherwise it could stay grabbed for longer than intended. Fixes: resurrecting-open-source-projects#402
Aright, so I guess that was it.
It'll be auto closed when #403 is merged. |
otherwise it could stay grabbed for longer than intended. Fixes: #402
I've merged the fix. Thanks for the report and the debugging. |
scrot -f -s -
(outputting to stdout) from the latest commit hangs and freezes the X server when attempting to take larger screenshots. The only way to recover is by switching to a different tty andpkill scrot
.Steps to reproduce
scrot -f -s -
.Additional context
I was using
scrot -fs - | xclip ...
to take area screenshots into my clipboard earlier when I noticed the issue described in [#381] (content captured byscrot -f -s
differs from the content that is frozen on), and as there seemed to be a fix in [#382], I compiled scrot myself from latest commit and noticed the problem above. It also doesn't seem to output any logs.The text was updated successfully, but these errors were encountered: