Merge lp:~juliank/apport/lp1746874 into lp:~apport-hackers/apport/trunk

Proposed by Julian Andres Klode
Status: Merged
Merged at revision: 3186
Proposed branch: lp:~juliank/apport/lp1746874
Merge into: lp:~apport-hackers/apport/trunk
Diff against target: 37 lines (+11/-3)
2 files modified
NEWS (+1/-0)
data/apport (+10/-3)
To merge this branch: bzr merge lp:~juliank/apport/lp1746874
Reviewer Review Type Date Requested Status
Apport upstream developers Pending
Review via email: mp+337558@code.launchpad.net

Description of the change

Use a 30s time out on the lock to workaround the issue where two apps crash at the same (or very close) time like in bug 1746874

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2018-02-02 01:22:59 +0000
3+++ NEWS 2018-02-12 13:42:44 +0000
4@@ -26,6 +26,7 @@
5 case so check for both.
6 * data/apport: add an exception handler in case either name space can not be
7 found.
8+ * data/apport: wait for lock, with 30s timeout (LP: #1746874)
9
10 2.20.8 (2017-11-15)
11 -------------------
12
13=== modified file 'data/apport'
14--- data/apport 2018-02-02 01:22:59 +0000
15+++ data/apport 2018-02-12 13:42:44 +0000
16@@ -40,12 +40,19 @@
17 error_log('cannot create lock file (uid %i): %s' % (os.getuid(), str(e)))
18 sys.exit(1)
19
20- try:
21- fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
22- except IOError:
23+ def error_running(*args):
24 error_log('another apport instance is already running, aborting')
25 sys.exit(1)
26
27+ original_handler = signal.signal(signal.SIGALRM, error_running)
28+ signal.alarm(30) # Timeout after that many seconds
29+ try:
30+ fcntl.lockf(fd, fcntl.LOCK_EX)
31+ except IOError:
32+ error_running()
33+ finally:
34+ signal.alarm(0)
35+ signal.signal(signal.SIGALRM, original_handler)
36
37 (pidstat, real_uid, real_gid, cwd) = (None, None, None, None)
38

Subscribers

People subscribed via source and target branches