Bug 96951

Summary: present_clear_window_flip: Assertion 'flip_pending->abort_flip' failed on exiting Xorg
Product: xorg Reporter: Tod Jackson <tod.jackson>
Component: Server/Ext/DRIAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Xorg.0.log.old
none
4.6.4 dmesg
none
the assert
none
gdb session 1
none
startx -- -core dump
none
startx intel_drv randr? segfault
none
present: Call set_abort_flip / restore_screen_pixmap in clear_window_flip
none
1.18.4 after patch1
none
after patch with intel
none
present: Make present_restore_screen_pixmap handle screen->root == NULL none

Description Tod Jackson 2016-07-16 00:08:08 UTC
Created attachment 125094 [details]
Xorg.0.log.old

I can reproduce this on glamor/modesetting and xf86-video-intel with DRI3 enabled unless I set Option "PageFlip" "0".

waiting for X server to shut down X: /var/tmp/portage/x11-base/xorg-server-9999/work/xorg-server-9999/present/present_screen.c:95: present_clear_window_flip: Assertion `flip_pending->abort_flip' failed.

On Slackware I can't recover any tty and have to hit the power button. Gentoo allows me to exit and logout, but the tty doesn't display properly.

I have git version of mesa and xorg-server as of today.

I attached dmesg, Xorg.0.log and the nohup.out I needed to get the assert.
Comment 1 Tod Jackson 2016-07-16 00:08:55 UTC
Created attachment 125095 [details]
4.6.4 dmesg
Comment 2 Tod Jackson 2016-07-16 00:09:19 UTC
Created attachment 125096 [details]
the assert
Comment 3 Tod Jackson 2016-07-18 00:33:53 UTC
It seems this only happens with compton running with --backend "glx".
Comment 4 Michel Dänzer 2016-07-26 08:14:55 UTC
I think I ran into this assertion before, but I can't seem to reproduce it right now. What kind of desktop session are you running, and how are you starting and leaving it?

Can you:

* Log into the machine remotely, and attach gdb to the Xorg process
* Reproduce the problem
* Run "bt full" at the gdb prompt when the assertion fails

and then attach the resulting backtrace here?

See https://www.x.org/wiki/Development/Documentation/ServerDebugging/ for some background information.
Comment 5 Tod Jackson 2016-07-28 01:01:19 UTC
Is this maybe related?
https://bugs.freedesktop.org/show_bug.cgi?id=94515

Despite my best efforts my gdb session seems to be lacking and they all look very similar to the one I attached. Sorry. :/ Not sure what I'm doing wrong.

Only happens with DRI3.
My test case is simply startx with a .xinitrc:

compton -b --backend glx
exec uxterm
compton-trans 90 <click xterm> # since sometimes compton's --opacity-rule "90:class_g='UXTerm" sometimes doesn't work...
sleep 90 ; exit # since the host display will freeze upon attach
<go attach remotely>

When run through gdb the host doesn't show an assert, just "refuses to die".
Comment 6 Tod Jackson 2016-07-28 01:01:45 UTC
Created attachment 125357 [details]
gdb session 1
Comment 7 Michel Dänzer 2016-07-28 01:18:21 UTC
(In reply to Tod Jackson from comment #5)
> Is this maybe related?
> https://bugs.freedesktop.org/show_bug.cgi?id=94515

I don't think so.


> Despite my best efforts my gdb session seems to be lacking and they all look
> very similar to the one I attached. Sorry. :/ Not sure what I'm doing wrong.

Maybe try running

 handle SIGTERM nostop noprint

when attaching gdb to Xorg, before continuing its execution and reproducing the problem.

BTW, you only need to get a backtrace after it actually failed the assertion.


> My test case is simply startx with a .xinitrc:

Thanks; I was already trying something similar, but despite trying to match your steps even more closely, I'm not able to reproduce it right now unfortunately.
Comment 8 Tod Jackson 2016-07-28 01:50:59 UTC
How strange, with your suggestion, handle SIGTERM nostop noprint, I don't get any assert and everything exits normally.
Comment 9 Michel Dänzer 2016-07-28 03:12:07 UTC
Sigh, sounds like gdb somehow affects the execution (timing?) such that the problem doesn't happen.

Next idea: Use

 startx -- -core

to start X, which should hopefully generate a core dump of the Xorg process after the crash (you may need to use ulimit to enable core dumps for the Xorg process). Then use

 gdb /path/to/Xorg <core dump file>

to run gdb with the core dump, and run "bt full" at its prompt.
Comment 10 Tod Jackson 2016-07-28 04:41:09 UTC
Created attachment 125359 [details]
startx -- -core dump
Comment 11 Tod Jackson 2016-07-29 02:07:32 UTC
I see you made a commit about this but I can't test because now Xorg breaks for me completely. I attached the Xorg log.
Comment 12 Tod Jackson 2016-07-29 02:08:06 UTC
Created attachment 125390 [details]
startx intel_drv randr? segfault
Comment 13 Michel Dänzer 2016-07-29 02:27:25 UTC
(In reply to Tod Jackson from comment #11)
> I see you made a commit about this

That fixes a different crash I was hitting while trying to reproduce this one, but I'm afraid it doesn't fix this one.


> but I can't test because now Xorg breaks for me completely. I attached the
> Xorg log.

That's a separate bug and should be tracked separately, ideally with a gdb backtrace.
Comment 14 Michel Dänzer 2016-07-29 10:26:25 UTC
Created attachment 125402 [details] [review]
present: Call set_abort_flip / restore_screen_pixmap  in clear_window_flip

Does this patch fix the problem?
Comment 15 Tod Jackson 2016-07-29 14:22:59 UTC
I'm not able to do a proper test right now but maybe you can make something of this attachment. Patched against 1.18.4.
Comment 16 Tod Jackson 2016-07-29 14:23:47 UTC
Created attachment 125416 [details]
1.18.4 after patch1
Comment 17 Tod Jackson 2016-07-29 17:52:15 UTC
That seems to fix it on modesetting but not intel. Am attaching a better version of the core dump (didn't have intel symbols before, I believe).

Probably unrelated but sometimes when I did compton --backend glx on modesetting the terminal would disappear completely, even without changing its opacity.
Comment 18 Tod Jackson 2016-07-29 17:52:52 UTC
Created attachment 125423 [details]
after patch with intel
Comment 19 Michel Dänzer 2016-08-02 09:25:08 UTC
Created attachment 125477 [details] [review]
present: Make present_restore_screen_pixmap  handle screen->root == NULL

Please try this patch together with the previous one.
Comment 20 Tod Jackson 2016-08-02 16:06:05 UTC
Those two patches fix the issue on both intel and modesetting. :)
Comment 21 Adam Jackson 2016-08-15 19:17:48 UTC
Merged, thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.