audit: Fix duplicated request logs #1659
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1659
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "elebedeva/frostfs-node:fix/duplicated-logs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When we do
object put
with audit enabled we get two entries in logs: with and without object id:Now:
Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com
@ -164,3 +164,3 @@
a.failed = true
}
if !errors.Is(err, util.ErrAbortStream) { // CloseAndRecv will not be called, so log here
if !errors.Is(err, util.ErrAbortStream) && a.objectID != nil { // CloseAndRecv will not be called, so log here
Could you explain, why this was called multiple times?
I would expect that if there is an error, that is it, finish.
The explanation should be a part of the commit message.
Updated commit message.
When we do
object put
with audit enabled we get several entries in logs: with and without object id.object put
request is logged in 2 places:(*auditPutStream) CloseAndRecv()
- when the client closes the request stream or when stream gets aborted.(*auditPutStream) Send()
- when stream was NOT aborted.Send()
does error check forErrAbortStream
because if there is any other error - CloseAndRecv will not be called and there won't be any audit log about failed request.It led to logging on every object chunck put, even if
err == nil
.Ok, this PR is approved by me.
But why do we call
CloseAndRecv()
only for this specific error and not for others? It seems there could be multiple logic errors, and ifCloseAndRecv()
does some kind of a graceful shutdown, we should always do it.See
if err := stream.Send(gStream.Context(), patchReq); err != nil {
I don't know why this was done this way.
Did some digging
It was introduced in
7f5fb130c0 (diff-f9fb9a9419164dc9a10f6de9003e9b0d771cfa48)
And it seems we use it to treat signature error as a status error.
audit: Fix duplicated request logsto WIP: audit: Fix duplicated request logscab33ead2e
to26ecf606c6
New commits pushed, approval review dismissed automatically according to repository settings
26ecf606c6
to471aeeaff3
WIP: audit: Fix duplicated request logsto audit: Fix duplicated request logsutil.ErrAbortStream
#1664Patch
method #1666