abrt-journal: call sd_journal_get_fd() right after sd_journal_open()
Resolves: rhbz#2128662 Signed-off-by: Michal Srb <michal@redhat.com>
This commit is contained in:
parent
d3f14892f8
commit
534292e248
@ -0,0 +1,65 @@
|
||||
From 4ebe2699287844d2766f87062c48d8953b292bfe Mon Sep 17 00:00:00 2001
|
||||
From: Michal Srb <michal@redhat.com>
|
||||
Date: Tue, 11 Oct 2022 22:41:33 +0200
|
||||
Subject: [PATCH] abrt-journal: call sd_journal_get_fd() right after
|
||||
sd_journal_open()
|
||||
|
||||
See: rhbz#2128662
|
||||
|
||||
Under certain circumstances, abrt-dump-journal can be running,
|
||||
but not receiving any event notifications from journal.
|
||||
|
||||
The culprit of the issue seems to be the delayed call
|
||||
to sd_journal_get_fd(), as discussed in various
|
||||
issues and pull-requests in other projects.
|
||||
See for example [1], [2], or [3].
|
||||
|
||||
[1]: https://github.com/systemd/systemd/issues/7998
|
||||
[2]: https://github.com/ledbettj/systemd-journal/pull/78
|
||||
[3]: https://github.com/rsyslog/rsyslog/issues/2436
|
||||
|
||||
Signed-off-by: Michal Srb <michal@redhat.com>
|
||||
---
|
||||
src/plugins/abrt-journal.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/plugins/abrt-journal.c b/src/plugins/abrt-journal.c
|
||||
index adc9440e..48ae8c99 100644
|
||||
--- a/src/plugins/abrt-journal.c
|
||||
+++ b/src/plugins/abrt-journal.c
|
||||
@@ -35,12 +35,15 @@
|
||||
struct abrt_journal
|
||||
{
|
||||
sd_journal *j;
|
||||
+ int fd;
|
||||
};
|
||||
|
||||
static int abrt_journal_new_flags(abrt_journal_t **journal, int flags)
|
||||
{
|
||||
sd_journal *j;
|
||||
const int r = sd_journal_open(&j, flags);
|
||||
+ const int fd = sd_journal_get_fd(j);
|
||||
+
|
||||
if (r < 0)
|
||||
{
|
||||
log_notice("Failed to open journal: %s", strerror(-r));
|
||||
@@ -49,6 +52,7 @@ static int abrt_journal_new_flags(abrt_journal_t **journal, int flags)
|
||||
|
||||
*journal = g_malloc0(sizeof(**journal));
|
||||
(*journal)->j = j;
|
||||
+ (*journal)->fd = fd;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -452,7 +456,7 @@ int abrt_journal_watch_run_sync(abrt_journal_watch_t *watch)
|
||||
sigdelset(&mask, SIGKILL);
|
||||
|
||||
struct pollfd pollfd;
|
||||
- pollfd.fd = sd_journal_get_fd(watch->j->j);
|
||||
+ pollfd.fd = watch->j->fd;
|
||||
pollfd.events = sd_journal_get_events(watch->j->j);
|
||||
|
||||
int r = 0;
|
||||
--
|
||||
2.37.3
|
||||
|
@ -49,11 +49,12 @@
|
||||
Summary: Automatic bug detection and reporting tool
|
||||
Name: abrt
|
||||
Version: 2.15.1
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
License: GPLv2+
|
||||
URL: https://abrt.readthedocs.org/
|
||||
Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: 0001-Fix-for-rpm-4.18.patch
|
||||
Patch1: 0002-abrt-journal-call-sd_journal_get_fd-right-after-sd_j.patch
|
||||
|
||||
BuildRequires: git-core
|
||||
BuildRequires: %{dbus_devel}
|
||||
@ -1008,6 +1009,10 @@ killall abrt-dbus >/dev/null 2>&1 || :
|
||||
%config(noreplace) %{_sysconfdir}/profile.d/abrt-console-notification.sh
|
||||
|
||||
%changelog
|
||||
* Wed Oct 12 2022 Michal Srb <michal@redhat.com> - 2.15.1-5
|
||||
- abrt-journal: call sd_journal_get_fd() right after sd_journal_open()
|
||||
- Resolves: rhbz#2128662
|
||||
|
||||
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.15.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user