After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 120725 - AccessibleEvent ref/unref queue corruption
AccessibleEvent ref/unref queue corruption
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: general
0.0.1
Other Linux
: Urgent critical
: ---
Assigned To: bill.haneman
bill.haneman
Depends on:
Blocks:
 
 
Reported: 2003-08-26 08:00 UTC by remus draica
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
a simple test program which is trying to simulate gnopernicus behaviour (2.05 KB, patch)
2003-08-26 08:03 UTC, remus draica
none Details | Review
and it results (4.58 KB, text/plain)
2003-08-26 08:04 UTC, remus draica
  Details
the resuts with DEBUG_OBJECTS flag (2.19 KB, text/plain)
2003-08-26 11:17 UTC, remus draica
  Details
Updated test program (2.11 KB, text/plain)
2003-08-26 12:13 UTC, padraig.obriain
  Details
results with last proposed test program (5.41 KB, text/plain)
2003-08-26 13:24 UTC, remus draica
  Details
Proposed patch (1.20 KB, patch)
2003-08-27 15:37 UTC, padraig.obriain
none Details | Review

Description remus draica 2003-08-26 08:00:54 UTC
If an event is retained to be used later, in that case something goes wrong.
I will attach a test file and it results.
Comment 1 remus draica 2003-08-26 08:03:59 UTC
Created attachment 19511 [details] [review]
a simple test program which is trying to simulate gnopernicus behaviour
Comment 2 remus draica 2003-08-26 08:04:58 UTC
Created attachment 19512 [details]
and it results
Comment 3 remus draica 2003-08-26 08:06:10 UTC
The test file can be copied in the at-spi/test directory with name
simple-at.c.
Comment 4 remus draica 2003-08-26 08:07:56 UTC
I changed the priority and severity because this bug makes gnopernicus
 to crashe.
Comment 5 remus draica 2003-08-26 08:17:30 UTC
Seems that this bug is present specially for "mouse:abs" event, but I
didn't test for other events.
 
Comment 6 padraig.obriain 2003-08-26 08:25:17 UTC
Do I need to run anopther program to cause the crash in the test
program or is having at-spi-registryd running sufficient?
Comment 7 remus draica 2003-08-26 08:41:59 UTC
You have to move mouse very quickly and in same time other events
shoud be fired. To reproduce this bug I used gedit. I opened a menu
and I moved mouse over the opened popup menu. I moved the mouse to
open onother popups and over their children.
Comment 8 padraig.obriain 2003-08-26 09:55:31 UTC
I am unable to reproduce this problem.

Can you determine what the value of ref->ref_count is when the problem
occurs, e.g. by running the test program in gdb.

The error message suggests that there is some corruption in the hash
table used to store accessible objects. Can you reproduce the problem
with the file at-spi/cspi/spi_main compiled with DEBUG_OBJECTS
defined. See line 36.
Comment 9 remus draica 2003-08-26 11:16:58 UTC
Yes, I can reproduce the bug. With DEBUG_OBJECTS compile flag is more
simple to reproduce. Now all I have to do is to move the mouse.
Also I modified spi_main.c file to show the values for "ref" pointer
and for "ref->ref_count" variable. 
Comment 10 remus draica 2003-08-26 11:17:51 UTC
Created attachment 19519 [details]
the resuts with DEBUG_OBJECTS flag
Comment 11 bill.haneman 2003-08-26 11:39:39 UTC
yes, it looks like corruption of the internal event list, since the
same address is getting allocated twice in a row.

Comment 12 padraig.obriain 2003-08-26 12:13:29 UTC
Created attachment 19520 [details]
Updated test program
Comment 13 padraig.obriain 2003-08-26 12:14:10 UTC
Remus,

Can you try with the updated test program?
Comment 14 padraig.obriain 2003-08-26 13:21:45 UTC
I have tried this on a linux system and I cannot reproduce it there
either. I find that the debug output from spi_main.c is different.

As well as "allocated" and "releasing" messages I also see "returning
cached" messages.
Comment 15 remus draica 2003-08-26 13:23:39 UTC
Padraig,

In your patch a "{" is missing at line 48.
The results are the same.
Comment 16 remus draica 2003-08-26 13:24:53 UTC
Created attachment 19522 [details]
results with last proposed test program
Comment 17 bill.haneman 2003-08-26 13:35:53 UTC
correction - I don't actually see any evidence of queue corruption in
the test results.  
Comment 18 padraig.obriain 2003-08-26 15:55:06 UTC
Remus,

What did you do in gedit to get the results you appended for the test
program? Sorry about the typo in the version Of the program I
attached.
Comment 19 bill.haneman 2003-08-26 16:44:57 UTC
still can't reproduce...
Comment 20 remus draica 2003-08-27 07:21:02 UTC
Padraig,

I tried mo make some actions which will generate a lot of mouse and,
in same time alot of other events. I choose to move the mouse over
menus, because in this way a lots of focus: events are generated for
menu-items and for menus. So, I opened a menu, then I moved the mouse
randomly over the menu-bar (to open other menus) and over then opened
menu.
Sometimes the crash occured immediatly, sometimes after more hardly,
but, always I get a crash in less than 1 minute.
Comment 21 padraig.obriain 2003-08-27 10:45:11 UTC
I have managed to get the crash to occur but I do not yet have a
reproducible test case.
Comment 22 padraig.obriain 2003-08-27 13:48:22 UTC
I am seeing cspi_object_return be called with accessible->on_loan set
to TRUE and accessible->ref_count with value of 2. cspi_dup_ref is
called and when it has returned accessible->ref_count has value 1. The
reason for this is that cspi_object_unref has been called in the
meantime and this has decremented the ref_count.

Comment 23 padraig.obriain 2003-08-27 15:36:38 UTC
I think I have a scenario which could cause the problem:

cspi_event calls cspi_object_return. This calls cspi_object_dup_ref.
While waiting for this call to return cspi_event may be called again.
If during this call the call calls AccessibleEvent_unref anddestroys
the event which calls Accessible_unref on the event source. If this
event source is the same accessible as that cspi_object_return was
called the reference count for the accessible will be decremented when
cspi_object_dup_ref returns.
Comment 24 padraig.obriain 2003-08-27 15:37:54 UTC
Created attachment 19553 [details] [review]
Proposed patch
Comment 25 padraig.obriain 2003-08-27 15:38:22 UTC
Remus,

Does the proposed patch cure the problem?
Comment 26 remus draica 2003-08-28 05:59:34 UTC
Padraig,

With your patch I am not able to reproduce this bug anymore.
Comment 27 padraig.obriain 2003-08-28 15:29:00 UTC
Bill,

Do we want to request release team permission to apply this patch?
Comment 28 bill.haneman 2003-08-28 15:49:40 UTC
Yes - I will prepare the email if you like, or you are welcome to do it.

- Bill
Comment 29 padraig.obriain 2003-08-28 16:02:01 UTC
If you want to write the email that is fine by me.

Are you satisfied with the patch?
Comment 30 bill.haneman 2003-08-28 16:10:22 UTC
Yes, the patch looks good (though I'd #undef the DEBUG_OBJECTS flag
again ;-)

Comment 31 padraig.obriain 2003-09-01 12:36:33 UTC
Patch committed to CVS HEAD.