5435f0d
From b736f477f5324f79af30fc0f941ba0714a34ccda Mon Sep 17 00:00:00 2001
5435f0d
From: Adam Jackson <ajax@redhat.com>
5435f0d
Date: Fri, 10 Oct 2008 16:33:24 -0400
5435f0d
Subject: [PATCH] mieq: Backtrace when the queue overflows.
5435f0d
5435f0d
Since we're probably stuck down in a driver somewhere, let's at least
5435f0d
try to point out where.  This will need to be rethought when the input
5435f0d
thread work lands though.
5435f0d
---
5435f0d
 mi/mieq.c |    6 ++++++
5435f0d
 1 files changed, 6 insertions(+), 0 deletions(-)
5435f0d
5435f0d
diff --git a/mi/mieq.c b/mi/mieq.c
5435f0d
index 0a1b740..062dede 100644
5435f0d
--- a/mi/mieq.c
5435f0d
+++ b/mi/mieq.c
5435f0d
@@ -169,6 +169,7 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
5435f0d
 	oldtail = (oldtail - 1) % QUEUE_SIZE;
5435f0d
     }
5435f0d
     else {
5435f0d
+	static int stuck = 0;
5435f0d
 	newtail = (oldtail + 1) % QUEUE_SIZE;
5435f0d
 	/* Toss events which come in late.  Usually this means your server's
5435f0d
          * stuck in an infinite loop somewhere, but SIGIO is still getting
5435f0d
@@ -176,8 +177,13 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
5435f0d
 	if (newtail == miEventQueue.head) {
5435f0d
             ErrorF("[mi] EQ overflowing. The server is probably stuck "
5435f0d
                    "in an infinite loop.\n");
5435f0d
+	    if (!stuck) {
5435f0d
+		xorg_backtrace();
5435f0d
+		stuck = 1;
5435f0d
+	    }
5435f0d
 	    return;
5435f0d
         }
5435f0d
+	stuck = 0;
5435f0d
 	miEventQueue.tail = newtail;
5435f0d
     }
5435f0d
 
5435f0d
-- 
5435f0d
1.6.0.1
5435f0d