Bug 39836

Summary: add a regression test/stress-test for thread-safe reference counting
Product: dbus Reporter: Simon McVittie <smcv>
Component: coreAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: enhancement    
Priority: medium CC: cosimo.alfarano, hp, will
Version: 1.4.xKeywords: patch
Hardware: All   
OS: All   
URL: http://cgit.freedesktop.org/~smcv/dbus/log/?h=atomic-refs-test-39836
Whiteboard: review+
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 36164    
Attachments: [PATCH 1/2] relay test: don't leak the server's address
[PATCH 2/2] Add a regression test for fd.o #38005
patch 2/2 adapted for dbus-1.4

Description Simon McVittie 2011-08-04 09:05:30 UTC
I've written a test for Bug #38005, which I'll attach in a moment. It basically refs and unrefs an object 4 million times in 200 threads, and checks that the refcount hits 0 at the right time.

(Perhaps those numbers are a bit enthusiastic, but on my dual-core laptop it takes 4 seconds and peaks at 15 MB resident, and even on a single-core ARM device it only takes 10 seconds.)
Comment 1 Simon McVittie 2011-08-04 09:09:04 UTC
Created attachment 49922 [details] [review]
[PATCH 1/2] relay test: don't leak the server's address

Not entirely related, but I noticed this while writing the new test.
Comment 2 Simon McVittie 2011-08-04 09:10:27 UTC
Created attachment 49923 [details] [review]
[PATCH 2/2] Add a regression test for fd.o #38005

This uses internal API so it can exercise (for instance) both the ref and ref_unlocked code paths, and also so it can create pending call objects.
Comment 3 Simon McVittie 2011-08-04 09:19:08 UTC
Created attachment 49924 [details] [review]
patch 2/2 adapted for dbus-1.4

The code is the same, only the Makefile.am differs.
Comment 4 Will Thompson 2011-08-05 04:32:37 UTC
Review of attachment 49922 [details] [review]:

Comment 5 Will Thompson 2011-08-05 04:56:52 UTC
Well, I was about to complain that 4 seconds seems like a lot, but it's dwarfed by the rest of the test suite. (Which is in itself not a good thing, but silences my vague objection. ☺) ++
Comment 6 Simon McVittie 2011-08-11 03:59:54 UTC
Thanks, fixed in 1.4.16, 1.5.8

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.