Bug 818385

Summary: trac daemon does not start: Error writing to pid file
Product: [Fedora] Fedora Reporter: Robert K. Moniot <moniot>
Component: tracAssignee: Gwyn Ciesla <gwync>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 16CC: dcantrell, fschwarz, gwync
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: trac-0.12.3-2.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-13 01:57:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch for /usr/lib/python2.7/site-packages/trac/util/daemon.py none

Description Robert K. Moniot 2012-05-02 22:32:19 UTC
Description of problem:

When starting /usr/sbin/tracd with --daemonize and --pidfile it dies, leaving a log message:
Error writing to pid file: IOError: [Errno 2] No such file or directory: '{path-to-pidfile}'


Version-Release number of selected component (if applicable):
trac-0.12.3-1.fc16.noarch

How reproducible: always


Steps to Reproduce:
1. Install trac and set up an environment as per instructions.  Example assumes trac runs as user 'trac' and environment is /var/lib/trac/projects/myproject/.  Be sure directory 'run' exists in environment and is owned by user trac.
2.As root, give command
runuser -l trac -c '/usr/sbin/tracd --daemonize --pidfile=/var/lib/trac/projects/myproject/run/tracd.pid --port=8181
3.
  
Actual results: 
Observe that tracd is not running


Expected results: 
Should be able to connect to daemon on localhost port 8181.


Additional info: 
This bug is documented with a fix at http://trac.edgewall.org/ticket/10566

The problem is that tracd daemon tests for writeability of pid file by an open that requires the file to exist.  But the file does not exist initially and if it did it is deleted when tracd instance exits.

The fix is to edit /usr/lib/python2.7/site-packages/trac/util/daemon.py, changing line 49:

<             fileobj = open(pidfile, 'r+')
---
>             fileobj = open(pidfile, 'w+')

Comment 1 Robert K. Moniot 2012-05-02 22:34:31 UTC
Created attachment 581729 [details]
patch for /usr/lib/python2.7/site-packages/trac/util/daemon.py

Comment 2 Gwyn Ciesla 2012-05-03 14:21:45 UTC
The attachment is empty, it's just that one line?

Comment 3 Robert K. Moniot 2012-05-03 20:23:26 UTC
The attachment is there.  (Clicking on the link in the Attachments box at the head of the thread, not the link in Comment 1.)

Anyway, yes, the change is in just that one line, change r+ to w+.  More details about it are at the edgewall link I gave.

Comment 4 Gwyn Ciesla 2012-05-04 13:54:49 UTC
Odd.  I see it now.  Coming soon.

Comment 5 Fedora Update System 2012-05-04 14:25:27 UTC
trac-0.12.3-2.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/trac-0.12.3-2.fc15

Comment 6 Fedora Update System 2012-05-04 14:25:43 UTC
trac-0.12.3-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/trac-0.12.3-2.fc16

Comment 7 Fedora Update System 2012-05-04 14:26:00 UTC
trac-0.12.3-2.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/trac-0.12.3-2.el6

Comment 8 Fedora Update System 2012-05-04 14:26:15 UTC
trac-0.12.3-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/trac-0.12.3-2.fc17

Comment 9 Fedora Update System 2012-05-04 16:00:41 UTC
Package trac-0.12.3-2.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing trac-0.12.3-2.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2012-5773/trac-0.12.3-2.el6
then log in and leave karma (feedback).

Comment 10 Robert K. Moniot 2012-05-04 17:14:25 UTC
I can't log in there to leave karma.  If I could it would be 5 stars or whatever is tops.

I installed trac-0.12.3-2.f16 from the updates site and tested it, it works.

Fast work.  Thanks.

Comment 11 Gwyn Ciesla 2012-05-04 17:30:15 UTC
The login for the above link is your Fedora Account System login, if you have one.  If not. . .thanks anyway. :)

Comment 12 Fedora Update System 2012-05-07 15:01:36 UTC
trac-0.12.3-3.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/trac-0.12.3-3.el6

Comment 13 Fedora Update System 2012-05-13 01:57:41 UTC
trac-0.12.3-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2012-05-13 01:58:26 UTC
trac-0.12.3-2.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2012-05-22 15:39:16 UTC
trac-0.12.3-3.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2012-05-26 07:38:06 UTC
trac-0.12.3-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.