On Fri, 2012-01-27 at 10:28 +0100, David Henningsson wrote: > I've noticed that modules unload in the same order that they are > created: i e, if module A loads first, and then module B, then module A > is also unloaded before module B when pulseaudio is shutting down. > > It feels more logical to me to have it the other way around, like a > "module stack", so if module A is loaded first, it should be unloaded last. > > Now, if you agree with me, dare we switch this around? It would at least > lead to that there is no module-null-sink loaded at shutdown ( \o/ ), > and maybe unloading module-dbus-protocol before module-udev-detect would > also reduce the risk of SIGSEGVs discovered yesterday. > > But there might be things I'm not seeing, so what do you think? I agree that it would make some sense to load the modules in a reverse order (or I think you said it better: it "feels logical"). I would guess that things are how they are because it was convenient to implement it that way. It's not very simple to iterate through the module idxset in a reverse order. In my opinion it should be safe to load and unload modules in what ever order - if there are crashes resulting from unloading the modules in certain order, the bug is not in the unloading order. So from that point of view I don't see it as a big deal if the modules are unloaded in the same order as they were loaded. The remaining question is what should be done about the null sink getting loaded at shutdown. I would prefer changing module-always-sink so that it doesn't load the null sink when the daemon is shutting down. Still, if someone posts a patch that reverses the module unloading order, I'd be fine with that too. -- Tanu