Bug 13091 - glean abort with "Segmentation fault" in GarbageCollectDRIDrawables
Summary: glean abort with "Segmentation fault" in GarbageCollectDRIDrawables
Status: VERIFIED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: git
Hardware: Other Linux (All)
: high critical
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
: 13211 (view as bug list)
Depends on:
Blocks: 12570
  Show dependency treegraph
 
Reported: 2007-11-04 22:47 UTC by Shuang He
Modified: 2009-08-24 12:28 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Shuang He 2007-11-04 22:47:36 UTC
System Environment:
--------------------------
--Platform: FC6
--Xf86_video_intel:b434c1a437c407de88396b219560649c2dae82b2
--Mesa:351a83163a9536dc91014cc59bb406a10cd26df4 
--DRM:bb5f2158dbd30dbbffa3881fac75b71d71ecaaf9
--Kernel:2.6.22

Bug detailed description:
--------------------------
glean always aborts with segment fault after finish tests for 3 visuals.
following is the output from glean:
api2:  NOTE rgba8, db, z24, s8, win+pmap, id 33
        Test skipped/non-applicable
api2:  NOTE rgba8, db, z24, s8, win+pmap, id 34
        Test skipped/non-applicable

basic:  PASS rgba8, db, z24, s8, win+pmap, id 33
Segmentation fault

The backtrace info is:
#0  0xb7b1e39f in driDestroyDrawable (drawable=0x8125f40)
    at ../common/dri_util.c:520
#1  0xb7ee5a28 in DestroyContext (dpy=0x80f54d0, gc=0x8125b88) at glxcmds.c:102
#2  0xb7ee5b63 in glXDestroyContext (dpy=0x80f54d0, gc=0x8125b88)
    at glxcmds.c:568
#3  0x08056e65 in ~RenderingContext (this=0xbfb8b304) at rc.cpp:152
#4  0x0805b197 in GLEAN::BaseTest<GLEAN::BasicResult>::run (this=0x80e7000,
    environment=@0xbfb8b370) at tbase.h:272
#5  0x08053f2b in main (argc=3, argv=0xbfb8b4b4) at main.cpp:128


Reproduce steps:
----------------
start X
./glean -r resultlog


Current result:
----------------
api2:  NOTE rgba8, db, z24, s8, win+pmap, id 33
        Test skipped/non-applicable
api2:  NOTE rgba8, db, z24, s8, win+pmap, id 34
        Test skipped/non-applicable

basic:  PASS rgba8, db, z24, s8, win+pmap, id 33
Segmentation fault


Expected result:
----------------
glean should run completely without Segmentation fault
Comment 1 haihao 2007-11-15 17:18:33 UTC
*** Bug 13211 has been marked as a duplicate of this bug. ***
Comment 2 Eric Anholt 2007-11-21 02:55:10 UTC
Looking at the structure, it's been overwritten by other data (function pointers are obviously not function pointers -- one is 1.0f, other is 0).  Running valgrind, there are a bunch of issues with freeing of shader structures, so I suspected the glsl work at first.  However, trying to find a good point to bisect from, I got all the way back to fe20ac2a6b6bb7dee927ee4040debf16e514a858 (sep 25th) with the same basic backtrace from glean.  Much earlier than that and I run into compatibility troubles with the libGL changes from the GLX 1.3 work.

So, when was the last time that glean worked?  I find it hard to believe that you haven't run glean since late september, so I wonder if I'm looking in the wrong place.

Also, I was testing on a 965, so I don't think this is a driver-specific issue (the bug report was put in the 915 category, though I don't see the actual chipset noted in the report).  Running with software GL, I get a backtrace that looks like the shader backtraces that valgrind was complaining about.
Comment 3 Shuang He 2007-11-21 17:34:25 UTC
Hi, Eric, 
We're continuously running glean, and according to our test result record,
glean is working well(our pass rate is 38/41) for i915 until:
09-22-07 bug #12570 showed up, our pass rate is 7/41
10-05-07 bug #12855 (11-02-07 fixed), our pass rate is 1/41
11-02-07 finally this issue, our pass rate is 2/41

for i965, glean is working(our pass rate is 37/41) well until 10-19-07, pass rate down to 1/41

hope these will help you
Comment 4 WuNian 2007-11-26 18:38:05 UTC
I found that when GLX create dricontext and make context current, it will fetch a dri drawable and inserts this drawable into the glx Hash table. (code path: MakeContextCurrent->FetchDRIDrawable-> __glxHashInsert).

When GLX destory dricontext, it will look up glx Hash table and get the dri drawable and destroy it, but it forgets to delete the Hash entry!!!
So when glean finish second round testing on second visual, it will destory the dri drawable, but it get the first dri drawable entry in hash table, which is wrong.

Below is the patch, it will fix this bug. If it is OK, please commit it in.


--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -101,6 +101,7 @@ static void GarbageCollectDRIDrawables(D
                   longer exists in the Xserver */
                (*pdraw->driDrawable.destroyDrawable)(&pdraw->driDrawable);
                XF86DRIDestroyDrawable(dpy, sc->scr, draw);
+                __glxHashDelete(sc->drawHash, draw);
                Xfree(pdraw);
            }
        } while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1);
Comment 5 Brian Paul 2007-11-27 17:25:04 UTC
I've checked in the patch from comment #4.  It appears it's not applicable to mesa_7_0_branch.
Comment 6 Kristian Høgsberg 2007-11-28 07:56:30 UTC
Thanks for fixing this.  Brian, you're right this in only on mesa master, not the 7.0 branch.
Comment 7 WuNian 2007-11-28 17:17:24 UTC
commit 16099c15f5495f22252c6bed655f7f598ebf8001
Comment 8 Adam Jackson 2009-08-24 12:28:18 UTC
Mass version move, cvs -> git


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.