FS#47596 - [screen] race condition with runtime directory

Attached to Project: Arch Linux
Opened by dbb (dbb) - Saturday, 02 January 2016, 15:42 GMT
Last edited by Gaetan Bisson (vesath) - Monday, 14 March 2016, 04:23 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Gaetan Bisson (vesath)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

I have two daemons (game servers) started in screen sessions so that I may issue commands to the running servers. Occasionally one systemd services that start the servers will fail on boot with the error:

Cannot make directory '/run/screens': File exists

This seems to be because of a race condition in screen where both instances will try to create that directory on first run and if they both test that the directory doesn't exist yet, whoever tries to create it second fails. As a side note the directory seems to be created with the group of whatever user runs screen first which seems odd.

I've "solved" this (it's hard to tell by the nature of a race condition) by creating a file /etc/tmpfiles.d/screen.conf:

d /run/screens 0755 root root -

So that the directory exists prior to any screen session being run. You may want to consider shipping this as part of the package in /usr/lib/tmpfiles.d

Thanks.

Package: screen 4.3.1-2
Steps to reproduce: Try to execute two screen sessions as close to simultaneously as possible prior to /run/screens existing.
This task depends upon

Closed by  Gaetan Bisson (vesath)
Monday, 14 March 2016, 04:23 GMT
Reason for closing:  Implemented
Additional comments about closing:  screen-4.3.1-3 in [extra]
Comment by Gaetan Bisson (vesath) - Monday, 14 March 2016, 04:16 GMT
Sure thing. Sorry it took me this long to reply. I missed this bug somehow. Cheers.

Loading...