Bug 44522

Summary: module-stream-restore may crash when upgrading from 0.9.23 to 1.1
Product: PulseAudio Reporter: Tanu Kaskinen <tanuk>
Component: modulesAssignee: Tanu Kaskinen <tanuk>
Status: RESOLVED FIXED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: stream-restore database file from 0.9.23

Description Tanu Kaskinen 2012-01-06 02:53:31 UTC
Created attachment 55201 [details]
stream-restore database file from 0.9.23

Wang Xingchao reported in irc that he was getting this assertion:

E: [pulseaudio] module-stream-restore.c: Assertion 'pa_hashmap_put(u->dbus_entries, de->entry_name, de) == 0' failed at modules/module-stream-restore.c:2306, function module_stream_restore_LTX_pa__init(). Aborting.

I asked him to send the database file to me, and it turns out that I can reproduce this issue. The problem is that at startup module-stream-restore iterates through all database entries and calls entry_read() for each entry. If entry_read() encounters an entry that is written by Pulseaudio 0.9.23, it will call entry_write(). This should not be done while iterating through the database. At least in case of the "simple" database implementation, this can cause the same entry to get returned twice from pa_database_next(), which will cause the reported assertion.

I'll attach the database file that can be used to reproduce this crash.
Comment 1 Tanu Kaskinen 2012-01-06 02:57:22 UTC
Assigning to myself. I plan to remove the 0.9.x -> 1.x conversion from entry_read() and add a phase to the stream-restore module initialization where the database is scanned for old or invalid entries. Old entries will be converted and invalid entries will be removed in a safe manner.
Comment 2 Tanu Kaskinen 2012-01-06 06:25:47 UTC
Fix sent to the mailing list for review: http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-January/012570.html

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.