From 265f0b768de1727abdc7aaa0f9c60c979b0cf4d6 Mon Sep 17 00:00:00 2001 From: Jakub Filak Date: Feb 10 2014 14:04:43 +0000 Subject: Binary python modules in sitearch, upload-watch consuming too much of CPU --- diff --git a/0001-python-install-modules-to-sitearch-directory.patch b/0001-python-install-modules-to-sitearch-directory.patch new file mode 100644 index 0000000..659ba70 --- /dev/null +++ b/0001-python-install-modules-to-sitearch-directory.patch @@ -0,0 +1,25 @@ +From e452c2b3586cc827d105e66b0bd08960a44e61a7 Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Fri, 31 Jan 2014 11:09:46 +0100 +Subject: [ABRT PATCH 01/11] python: install modules to sitearch directory + +Signed-off-by: Jakub Filak +--- + src/python-problem/problem/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/python-problem/problem/Makefile.am b/src/python-problem/problem/Makefile.am +index cd8f04e..c7d99cb 100644 +--- a/src/python-problem/problem/Makefile.am ++++ b/src/python-problem/problem/Makefile.am +@@ -1,6 +1,6 @@ + problem_PYTHON = __init__.py exception.py proxies.py tools.py watch.py config.py + +-problemdir = $(pythondir)/problem ++problemdir = $(pyexecdir)/problem + + pyabrtdir = $(problemdir) + pyabrt_LTLIBRARIES = _pyabrt.la +-- +1.8.3.1 + diff --git a/0011-upload-watch-remove-busy-wait-for-SIGUSR1.patch b/0011-upload-watch-remove-busy-wait-for-SIGUSR1.patch new file mode 100644 index 0000000..dd0ad2a --- /dev/null +++ b/0011-upload-watch-remove-busy-wait-for-SIGUSR1.patch @@ -0,0 +1,114 @@ +From c12b430997567f3d68ec8e7ba76674f20c27441b Mon Sep 17 00:00:00 2001 +From: Jakub Filak +Date: Fri, 7 Feb 2014 17:54:14 +0100 +Subject: [ABRT PATCH 11/11] upload-watch: remove busy-wait for SIGUSR1 + +Unconditional checking of SIGUSR1 flag in the idle source of main loop +causes 100% CPU usage. + +hanle_sigusr() function and got_sigusr flag are not necessary because +abrt-upload-watch already implements signal handling based on usage of +GIO Channels. + +Closes rhbz#1060020 + +Signed-off-by: Jakub Filak +--- + src/daemon/abrt-upload-watch.c | 37 +++++++++---------------------------- + 1 file changed, 9 insertions(+), 28 deletions(-) + +diff --git a/src/daemon/abrt-upload-watch.c b/src/daemon/abrt-upload-watch.c +index 59bfbe4..a42b285 100644 +--- a/src/daemon/abrt-upload-watch.c ++++ b/src/daemon/abrt-upload-watch.c +@@ -27,7 +27,6 @@ + #define DEFAULT_CACHE_MIB_SIZE 4 + + static int g_signal_pipe[2]; +-static sig_atomic_t got_sigusr; + + struct queue + { +@@ -122,24 +121,11 @@ handle_new_path(struct process *proc, char *name) + } + } + +-static gboolean ++static void + print_stats(struct process *proc) + { +- /* there is a race, because we run this function from 2 different places +- * 1st when a child dies +- * 2nd as idle source from mainloop +- * if it happens the stats will be printed twice, which I think +- * is not a big deal, because it's only for debug and tests +- */ +- if (got_sigusr == 1) +- { +- got_sigusr = 0; +- /* this is meant only for debugging, so not marking it as translatable */ +- fprintf(stderr, "%i archives to process, %i active workers\n", g_queue_get_length(&proc->queue.q), proc->children); +- } +- +- /* don't remove this source from glib */ +- return true; ++ /* this is meant only for debugging, so not marking it as translatable */ ++ fprintf(stderr, "%i archives to process, %i active workers\n", g_queue_get_length(&proc->queue.q), proc->children); + } + + static void +@@ -157,13 +143,6 @@ process_next_in_queue(struct process *proc) + } + + static void +-handle_sigusr(int signo) +-{ +- /* just set the flag and process it synchronously */ +- got_sigusr = 1; +-} +- +-static void + handle_signal(int signo) + { + int save_errno = errno; +@@ -200,7 +179,11 @@ handle_signal_pipe_cb(GIOChannel *gio, GIOCondition condition, gpointer user_dat + { + /* we did receive a signal */ + log_debug("Got signal %d through signal pipe", signals[signo]); +- if (signals[signo] != SIGCHLD) ++ if (signals[signo] == SIGUSR1) ++ { ++ print_stats(proc); ++ } ++ else if (signals[signo] != SIGCHLD) + { + process_quit(proc); + return FALSE; /* remove this event */ +@@ -363,7 +346,7 @@ main(int argc, char **argv) + close_on_exec_on(g_signal_pipe[1]); + ndelay_on(g_signal_pipe[0]); + ndelay_on(g_signal_pipe[1]); +- signal(SIGUSR1, handle_sigusr); ++ signal(SIGUSR1, handle_signal); + signal(SIGTERM, handle_signal); + signal(SIGINT, handle_signal); + signal(SIGCHLD, handle_signal); +@@ -373,7 +356,6 @@ main(int argc, char **argv) + handle_signal_pipe_cb, + &proc); + +- int status_callback_source_id = g_idle_add((GSourceFunc)print_stats, &proc); + log_info("Starting glib main loop"); + + g_main_loop_run(proc.main_loop); +@@ -381,7 +363,6 @@ main(int argc, char **argv) + log_info("Glib main loop finished"); + + g_source_remove(channel_signal_source_id); +- g_source_remove(status_callback_source_id); + + GError *error = NULL; + g_io_channel_shutdown(channel_signal, FALSE, &error); +-- +1.8.3.1 + diff --git a/abrt.spec b/abrt.spec index 00452e4..8c6a47e 100644 --- a/abrt.spec +++ b/abrt.spec @@ -40,13 +40,19 @@ Summary: Automatic bug detection and reporting tool Name: abrt Version: 2.1.12 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: Applications/System URL: https://fedorahosted.org/abrt/ Source: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz # don't remove this patch, packages in rawhide are not signed! -Patch0: disable_gpg_check.patch +Patch0: disable-OpenGPGCheck-in-Fedora-Rawhide.patch + +Patch1: 0001-python-install-modules-to-sitearch-directory.patch +Patch11: 0011-upload-watch-remove-busy-wait-for-SIGUSR1.patch + +# '%%autosetup -S git' -> git +BuildRequires: git BuildRequires: dbus-devel BuildRequires: gtk3-devel @@ -78,7 +84,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-libs = %{version}-%{release} Requires(pre): shadow-utils Requires: python-dbus -Requires: libreport-plugin-ureport +Requires: libreport-plugin-ureport >= %{libreport_ver} %description %{name} is a tool to help users to detect defects in applications and @@ -370,11 +376,16 @@ A small script which prints a count of detected problems when someone logs in to the shell %prep -%setup -q -%patch0 -p1 -b .gpgcheck +# http://www.rpm.org/wiki/PackagerDocs/Autosetup +# Default '__scm_apply_git' is 'git apply && git commit' but this workflow +# doesn't allow us to create a new file within a patch, so we have to use +# 'git am' (see /usr/lib/rpm/macros for more details) +%define __scm_apply_git(qp:m:) %{__git} am +%autosetup -S git %build -#autoconf +autoreconf --force --install +intltoolize --force --copy --automake CFLAGS="%{optflags} -Werror" %configure --enable-doxygen-docs --disable-silent-rules make %{?_smp_mflags} @@ -831,7 +842,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_defaultdocdir}/%{name}-dbus%{docdirversion}/html/*.css %files python -%{python_sitelib}/problem/ +%{python_sitearch}/problem/ %{_mandir}/man5/abrt-python.5.gz %files python-doc @@ -841,6 +852,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh %changelog +* Mon Feb 10 2014 Jakub Filak - 2.1.12-2 +- python: install modules to sitearch directory +- upload-watch: remove busy-wait for SIGUSR1 + * Thu Jan 30 2014 Jakub Filak 2.1.12-1 - don't break the event run by failures of abrt-action-notify - harvest-vmcore: properly handle inaccessible dir error diff --git a/disable-OpenGPGCheck-in-Fedora-Rawhide.patch b/disable-OpenGPGCheck-in-Fedora-Rawhide.patch new file mode 100644 index 0000000..11d8c3e --- /dev/null +++ b/disable-OpenGPGCheck-in-Fedora-Rawhide.patch @@ -0,0 +1,26 @@ +From 1ef034096efe367af85f568bc982af969124003b Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 10 Feb 2014 09:39:07 +0100 +Subject: [PATCH] disable OpenGPGCheck in Fedora Rawhide + +Packages in Fedora Rawhide are not signed. +--- + src/daemon/abrt-action-save-package-data.conf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/daemon/abrt-action-save-package-data.conf b/src/daemon/abrt-action-save-package-data.conf +index 3d35bb6..e3f724a 100644 +--- a/src/daemon/abrt-action-save-package-data.conf ++++ b/src/daemon/abrt-action-save-package-data.conf +@@ -3,7 +3,7 @@ + # the list of public keys used to check the signature is + # in the file gpg_keys + # +-OpenGPGCheck = yes ++OpenGPGCheck = no + + # Blacklisted packages + # +-- +1.8.3.1 + diff --git a/disable_gpg_check.patch b/disable_gpg_check.patch deleted file mode 100644 index 6f471c2..0000000 --- a/disable_gpg_check.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- abrt-2.0.13/src/daemon/abrt-action-save-package-data.conf 2012-08-06 10:13:24.000000000 +0200 -+++ abrt-2.0.13_/src/daemon/abrt-action-save-package-data.conf 2012-09-21 16:20:19.943882773 +0200 -@@ -3,7 +3,7 @@ - # the list of public keys used to check the signature is - # in the file gpg_keys - # --OpenGPGCheck = yes -+OpenGPGCheck = no - - # Blacklisted packages - #