|
|
b225ea |
From 44cb33f417d62210759c1730ca13bb03165c47ad Mon Sep 17 00:00:00 2001
|
|
|
b225ea |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
b225ea |
Date: Tue, 19 Jul 2016 20:33:06 +0200
|
|
|
b225ea |
Subject: [PATCH] handle-event: stop creating post-create lock
|
|
|
b225ea |
|
|
|
b225ea |
Since the post-create synchronization has been moved to abrtd and
|
|
|
b225ea |
abrt-server, there is no need to crate the post-create.lock file.
|
|
|
b225ea |
|
|
|
b225ea |
Resolves #1132459
|
|
|
b225ea |
|
|
|
b225ea |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
b225ea |
---
|
|
|
b225ea |
src/daemon/abrt-handle-event.c | 58 ------------------------------------------
|
|
|
b225ea |
1 file changed, 58 deletions(-)
|
|
|
b225ea |
|
|
|
b225ea |
diff --git a/src/daemon/abrt-handle-event.c b/src/daemon/abrt-handle-event.c
|
|
|
b225ea |
index 8870901..caed577 100644
|
|
|
b225ea |
--- a/src/daemon/abrt-handle-event.c
|
|
|
b225ea |
+++ b/src/daemon/abrt-handle-event.c
|
|
|
b225ea |
@@ -318,51 +318,6 @@ end:
|
|
|
b225ea |
return retval;
|
|
|
b225ea |
}
|
|
|
b225ea |
|
|
|
b225ea |
-static void create_lockfile(void)
|
|
|
b225ea |
-{
|
|
|
b225ea |
- char pid_str[sizeof(long)*3 + 4];
|
|
|
b225ea |
- sprintf(pid_str, "%lu", (long)getpid());
|
|
|
b225ea |
- char *lock_filename = concat_path_file(g_settings_dump_location, "post-create.lock");
|
|
|
b225ea |
-
|
|
|
b225ea |
- /* Someone else's post-create may take a long-ish time to finish.
|
|
|
b225ea |
- * For example, I had a failing email sending there, it took
|
|
|
b225ea |
- * a minute to time out.
|
|
|
b225ea |
- * That's why timeout is large (100 seconds):
|
|
|
b225ea |
- */
|
|
|
b225ea |
- int count = 100;
|
|
|
b225ea |
- while (1)
|
|
|
b225ea |
- {
|
|
|
b225ea |
- /* Return values:
|
|
|
b225ea |
- * -1: error (in this case, errno is 0 if error message is already logged)
|
|
|
b225ea |
- * 0: failed to lock (someone else has it locked)
|
|
|
b225ea |
- * 1: success
|
|
|
b225ea |
- */
|
|
|
b225ea |
- int r = create_symlink_lockfile(lock_filename, pid_str);
|
|
|
b225ea |
- if (r > 0)
|
|
|
b225ea |
- break;
|
|
|
b225ea |
- if (r < 0)
|
|
|
b225ea |
- error_msg_and_die("Can't create '%s'", lock_filename);
|
|
|
b225ea |
- if (--count == 0)
|
|
|
b225ea |
- {
|
|
|
b225ea |
- /* Someone else's post-create process is alive but stuck.
|
|
|
b225ea |
- * Don't wait forever.
|
|
|
b225ea |
- */
|
|
|
b225ea |
- error_msg("Stale lock '%s', removing it", lock_filename);
|
|
|
b225ea |
- xunlink(lock_filename);
|
|
|
b225ea |
- break;
|
|
|
b225ea |
- }
|
|
|
b225ea |
- sleep(1);
|
|
|
b225ea |
- }
|
|
|
b225ea |
- free(lock_filename);
|
|
|
b225ea |
-}
|
|
|
b225ea |
-
|
|
|
b225ea |
-static void delete_lockfile(void)
|
|
|
b225ea |
-{
|
|
|
b225ea |
- char *lock_filename = concat_path_file(g_settings_dump_location, "post-create.lock");
|
|
|
b225ea |
- xunlink(lock_filename);
|
|
|
b225ea |
- free(lock_filename);
|
|
|
b225ea |
-}
|
|
|
b225ea |
-
|
|
|
b225ea |
static char *do_log(char *log_line, void *param)
|
|
|
b225ea |
{
|
|
|
b225ea |
/* We pipe output of events to our log.
|
|
|
b225ea |
@@ -428,23 +383,10 @@ int main(int argc, char **argv)
|
|
|
b225ea |
make_run_event_state_forwarding(run_state);
|
|
|
b225ea |
run_state->logging_callback = do_log;
|
|
|
b225ea |
if (post_create)
|
|
|
b225ea |
- {
|
|
|
b225ea |
run_state->post_run_callback = is_crash_a_dup;
|
|
|
b225ea |
- /*
|
|
|
b225ea |
- * The post-create event cannot be run concurrently for more problem
|
|
|
b225ea |
- * directories. The problem is in searching for duplicates process
|
|
|
b225ea |
- * in case when two concurrently processed directories are duplicates
|
|
|
b225ea |
- * of each other. Both of the directories are marked as duplicates
|
|
|
b225ea |
- * of each other and are deleted.
|
|
|
b225ea |
- */
|
|
|
b225ea |
- create_lockfile();
|
|
|
b225ea |
- }
|
|
|
b225ea |
|
|
|
b225ea |
int r = run_event_on_dir_name(run_state, dump_dir_name, event_name);
|
|
|
b225ea |
|
|
|
b225ea |
- if (post_create)
|
|
|
b225ea |
- delete_lockfile();
|
|
|
b225ea |
-
|
|
|
b225ea |
const bool no_action_for_event = (r == 0 && run_state->children_count == 0);
|
|
|
b225ea |
|
|
|
b225ea |
free_run_event_state(run_state);
|
|
|
b225ea |
--
|
|
|
b225ea |
1.8.3.1
|
|
|
b225ea |
|