! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Race condition bethen programs at startup
Status:
RESOLVED: FIXED
Severity:
critical
Product:
Xfce4-session
Component:
General

Comments

Description Pablo Lezaeta 2013-08-12 15:40:13 CEST
Actually since Nick not want sound at startup I use a startup program (you know, those scripts for make program at startup of xfce )
so I discover that those not fallow any class/type of order
this deal in race condition

for My specific case I do a paplay /pat/to/sound/that/aplay/cant/handel.ogg
so The sound never sound because pulseaudio (in this case) start at the end but this script if oe of the first in start

this is a vague example but here happen

so, I suggest give ordering or any way to make sure that a programs (for exaple) is the last in startup or before/after another that startup
Comment 1 Maximilien Noal 2013-08-13 11:35:51 CEST
I have the same problem.
I use PulseAudio and Timidity++
I have /etc/xdg/autostart/pulseaudio.desktop to start PA (provided by the pulseaudio package)
I have .config/autostart/timidity.desktop to start Timidity++ (created with xfce4-sessions-settings => Automatic Startup)

Sometimes, PA starts *before* Timidity++, and I have sound (which is what should happen).
Other times, PA starts *after* Timidity++, and I have no sound at all (which is what should *not* happen)

Here is my workaround :
I have removed .config/autostart/timidity.desktop and disabled /etc/xdg/autostart/pulseaudio.desktop with xfce4-sessions-settings => Automatic Startup
I have created with xfce4-sessions-settings an entry called "start sound systems", which launches ~/bin/audio.sh

~/bin/audio.sh contains the following :
start-pulseaudio-x11 &
sleep 5
xfce4-volumed-pulse &
timidity -iAD -Os &
pnmixer &

I'm using Archlinux, if that's relevant.
Comment 2 Steve Dodier-Lazaro editbugs 2014-05-01 01:12:57 CEST
Hi,

Just as a note to future readers, it's likely now that your distro is using systemd which can spawn userspace services with management of dependencies (a good fit to start your daemons in the appropriate order). You'd need to make sure to start them in the right session though and do quite a lot of systemd homework, but the XDG autostart spec doesn't specify anything about ordering and dependencies so from a single project perspective it's very hard to manage incompatibilities between various third-party projects.

There might be an enhancement to write in Xfce4-Sessions to define an order between detected autostart apps but it'd still need user intervention to define the order based on what breaks what in your specific distro. I'd rather let people use systemd which is designed just for that.
Comment 3 Pablo Lezaeta 2014-05-01 07:25:20 CEST
Distro mean linux, and systemd is non-portable to non-linux systems by design so you solution is either not factible to BSD or pre 2.9.36 kernel-linux systems.

And systemd not handle startup-in-desktop things.

I thing is beter a enhanted to xfce-session that define and order or something than an version-linux specific that-uptrea-systemd-thing-is-consern-of-the-desktop
Comment 4 Steve Dodier-Lazaro editbugs 2014-05-01 14:31:23 CEST
Hi Pablo,

I'm just a user like you, so I don't know the internals of xfce4-session and how hard it would be to code what you're asking for. I merely wrote the comment to propose Linux users landing here a workaround. There are also more direct solutions like Maximilien's.

I don't think this feature should be written "critical" at all. Supporting people who install incompatible services but don't want to work around the incompatibility themselves should be enhancement-grade, in my opinion.

Though if you're interested in trying to fix it yourself, you should start here: http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html and see if you can create some extra XFCE-only keys that give ordering and/or dependencies to service files. Then you can setup the proper service files to make your PulseAudio start first, and email all the upstream developers to add your key to their service files.
Comment 5 god12 2014-06-05 18:57:16 CEST
I've got the same problem although with different programs. As a temporary workaround you might try to play with "priority" field in ~/.cache/sessions/xfce4-session*
However I agree Steve - much better solution would be to use systemd (if available) to manage user session with proper dependencies.
Comment 6 Simon Steinbeiss editbugs 2019-05-18 23:04:04 CEST
I recently improved the startup sequencing in xfce4-session, relying on the priority field. You can use this now via xfconf (so no need to tweak things via the saved sessions anymore) and it should help.
https://git.xfce.org/xfce/xfce4-session/commit/?id=0a915310582803296fbfb075e1ea1c045b20bfcc

For more elaborate things systemd seems like a good choice.

Bug #10296

Reported by:
Pablo Lezaeta
Reported on: 2013-08-12
Last modified on: 2019-05-18

People

Assignee:
Xfce Bug Triage
CC List:
7 users

Version

Version:
4.10.1

Attachments

Additional information