Modify ↓
Opened 13 years ago
Closed 13 years ago
#10586 closed defect (duplicate)
tracd doesn't create PID file and crash if try to start with --pidfile option
Reported by: | Owned by: | kvt | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | 0.12-stable |
Severity: | major | Keywords: | pid, writing, tracd, pidfile |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
If try to start tracd with —pidfile option and PID-file is not exists you will see error message: "Error writing to pid file: …"
This problem occurs because in trac.util.daemon doesn't try create PID file if it not exist but try opening for read.
This problem can be fixed if make changes in trac/util/daemon.py (lines 26-44)
pidfile = os.path.abspath(pidfile) if os.path.exists(pidfile): with open(pidfile) as fileobj: try: pid = int(fileobj.read()) except ValueError: sys.exit('Invalid PID in file %s' % pidfile) try: # signal the process to see if it is still running os.kill(pid, 0) if not progname: progname = os.path.basename(sys.argv[0]) sys.exit('%s is already running with pid %s' % (progname, pid)) except OSError, e: if e.errno != errno.ESRCH: raise else: fileobj = open(pidfile, 'w') fileobj.close()
see attachments
Attachments (1)
Note:
See TracTickets
for help on using tickets.
File with fix for ticket #10586