Skip to content
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

Fix %err_code/%err_detail for some error:transaction-end-before-headers #264

Conversation

eduard-bagdasaryan
Copy link

@eduard-bagdasaryan eduard-bagdasaryan commented Sep 16, 2024

These format codes were empty in some situations for the second (and
subsequent) pipeline transactions if something went wrong with the
previous transaction (e.g., client connection was aborted, server
send an incomplete response body, etc.). Now a new ERR_STREAM_FAILURE
error code marks all these cases.

src/client_side.cc Outdated Show resolved Hide resolved
@@ -81,6 +81,7 @@ typedef enum {
ERR_REQUEST_START_TIMEOUT, // Aborts the connection instead of error page
ERR_REQUEST_PARSE_TIMEOUT, // Aborts the connection instead of error page
ERR_RELAY_REMOTE, // Sends server reply instead of error page
ERR_STREAM_FAILURE, // No client to send the error page to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a distinct description (currently it duplicates ERR_CLIENT_GONE).

src/client_side.cc Outdated Show resolved Hide resolved
and resort to ERR_STREAM_FAILURE if rawError is missing.
debugs(83, 5, "forgetting client " << intputToConsume << " bytes: " << inBuf.length());
inBuf.clear();
} else {
bareError.update(error ? error : ERR_STREAM_FAILURE); // XXX: bareLogTagsErrors

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change secretly drops WITH_CLIENT detail for ERR_NONE cases (those cases are converted to ERR_STREAM_FAILURE here). Assuming that drop is intentional/correct, we should adjust this function code (including comments) to make that drop explicit/expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusted. I left the XXX for now - I could not recollect its meaning.

debugs(83, 5, "forgetting client " << intputToConsume << " bytes: " << inBuf.length());
inBuf.clear();
} else {
bareError.update(error ? error : ERR_STREAM_FAILURE); // XXX: bareLogTagsErrors

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before this change, bareError update logic was fairly simple/clear1: If there are no transactions in the pipeline, then this function does not give error to any transaction, so we should store error in bareError (that will be used later, when creating and logging unparsed transaction, if any).

Now bareError update code is completely ignoring the presence of pipeline transactions (and their use of error) and entangles bareError update with complex logic of determining whether any unparsed transactions exist.

Can we simplify PR changes/code by updating bareError where it was updated before, but doing so unconditionally, leaving complex (and buggy!) code that determines the presence of unparsed transactions intact? If ConnStateData ends up using updated bareError, great! If updated bareError remains unused, it is not a big deal. IIRC, that data member exists "just in case it is needed for future transaction objects".

Footnotes

  1. I am not implying that old logic was correct.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@eduard-bagdasaryan
Copy link
Author

Opened another PR instead, which does not depend on SQUID-977-do-not-log-twice changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants