-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
journal-gatewayd: fix segfault with certain request #3893
Conversation
This fixes the segfault, but I don't think that the correct solution. The failure only happens when follow is specified. With your patch an error would be returned, but what should happen instead is that we should return nothing and wait for matching entries to appear. (E.g. if the match is the MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 and we are waiting for a coredump, we cannot assume that at least one will be available when we start. It's OK to get no entries initially with follow.) |
@keszybz Okay, I'll retry it. |
6fc32e7
to
9fd0d00
Compare
@@ -239,6 +239,10 @@ static ssize_t request_reader_entries( | |||
m->size = (uint64_t) sz; | |||
} | |||
|
|||
if (m->tmp == NULL && m->follow) { | |||
return (ssize_t) 0; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use {} around a single statement (see CODING_STYLE).
The cast is not needed, 0 is already a signed integer, and the compiler will do the size promotion automatically if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add 'Fixes #3873' to the commit description so that github will close the issue automaticallly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review. I've updated it.
9fd0d00
to
400f5ab
Compare
When client requests to get logs with `follow` and `KEY=match` that doesn't match any log entry, journal-gatewayd segfaulted. Make request_reader_entries to return zero in such case to wait for matching entries. This fixes systemd#3873.
400f5ab
to
9fc5f53
Compare
Thanks! |
When client requests to get logs with `follow` and `KEY=match` that doesn't match any log entry, journal-gatewayd segfaulted. Make request_reader_entries to return zero in such case to wait for matching entries. This fixes systemd#3873. (cherry picked from commit 3475fc5)
When client requests to get logs with `follow` and `KEY=match` that doesn't match any log entry, journal-gatewayd segfaulted. Make request_reader_entries to return zero in such case to wait for matching entries. This fixes systemd#3873. (cherry picked from commit 3475fc5)
When client requests to get logs with
follow
andKEY=match
that doesn'tmatch any log entry, journal-gatewayd segfaulted.
This fixes #3873.