-
Notifications
You must be signed in to change notification settings - Fork 796
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
TS-4509: Add outstanding_bytes
to VConnection
#1070
Conversation
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/915/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/810/ for details. |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/916/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/811/ for details. |
// How many bytes have been queued to the OS for sending by haven't been sent yet | ||
// Not all platforms support this, and if they don't we'll return -1 for them | ||
virtual int | ||
oustanding_bytes() |
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.
s/oustanding_bytes/outstanding/
// How many bytes have been queued to the OS for sending by haven't been sent yet | ||
// Not all platforms support this, and if they don't we'll return -1 for them | ||
virtual int | ||
oustanding_bytes() |
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.
int64_t outstanding_bytes() const
Since we use int64_t for byte counts.
UnixNetVConnection::oustanding_bytes() | ||
{ | ||
int n; | ||
ioctl(this->get_socket(), TIOCOUTQ, &n); |
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.
Check the return, non-Linux doesn't support TIOCOUTQ
usage in this way.
int n; | ||
ioctl(this->get_socket(), TIOCOUTQ, &n); | ||
return n; | ||
}; |
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.
No trailing ;
.
// on the wire to the server we cannot gaurantee that the request is safe to redispatch to another server. | ||
// requests on the origin to fire tracking events etc. So, as a proxy once bytes have been ACKd | ||
// to the server we cannot gaurantee that the request is safe to retry or redispatch to another server. | ||
// This is destinction of "ACKd" vs "sent" is intended, and has reason. In the case of a |
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.
s/destinction/distinction/
@@ -6536,14 +6536,23 @@ HttpTransact::is_request_valid(State *s, HTTPHdr *incoming_request) | |||
// In the general case once bytes have been sent on the wire the request cannot be retried. | |||
// The reason we cannot retry is that the rfc2616 does not make any gaurantees about the | |||
// retry-ability of a request. In fact in the reverse proxy case it is quite common for GET | |||
// requests on the origin to fire tracking events etc. So, as a proxy once we have sent bytes | |||
// on the wire to the server we cannot gaurantee that the request is safe to redispatch to another server. | |||
// requests on the origin to fire tracking events etc. So, as a proxy once bytes have been ACKd |
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.
So, as a proxy, once ...
// requests on the origin to fire tracking events etc. So, as a proxy once we have sent bytes | ||
// on the wire to the server we cannot gaurantee that the request is safe to redispatch to another server. | ||
// requests on the origin to fire tracking events etc. So, as a proxy once bytes have been ACKd | ||
// to the server we cannot gaurantee that the request is safe to retry or redispatch to another server. |
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.
by the server
// requests on the origin to fire tracking events etc. So, as a proxy once we have sent bytes | ||
// on the wire to the server we cannot gaurantee that the request is safe to redispatch to another server. | ||
// requests on the origin to fire tracking events etc. So, as a proxy once bytes have been ACKd | ||
// to the server we cannot gaurantee that the request is safe to retry or redispatch to another server. |
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.
s/gaurantee/guarantee/
// to the server we cannot gaurantee that the request is safe to retry or redispatch to another server. | ||
// This is destinction of "ACKd" vs "sent" is intended, and has reason. In the case of a | ||
// new origin connection there is little difference, as the chance of a RST between setup | ||
// and the first set of bytes is relatively small. This destinction is more apparent in the |
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.
s/destinction/distinction/
// This is destinction of "ACKd" vs "sent" is intended, and has reason. In the case of a | ||
// new origin connection there is little difference, as the chance of a RST between setup | ||
// and the first set of bytes is relatively small. This destinction is more apparent in the | ||
// case where the origin connection is a KA session. In this case, the seesion may not have |
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.
s/seession/session/
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/917/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/812/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/813/ for details. |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/919/ for details. |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/920/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/814/ for details. |
@jpeach I've updated the PR with your feedback-- although I'm not sure how to mark it as "done"-- its still showing that you have changes requested which is odd :/ |
Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/816/ for details. |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/922/ for details. |
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 use the "TS-xxxx: description" convention for the PR and commit subjects.
@@ -5310,9 +5310,6 @@ HttpSM::handle_post_failure() | |||
tunnel.deallocate_buffers(); | |||
tunnel.reset(); | |||
// Server died | |||
vc_table.cleanup_entry(server_entry); | |||
server_entry = NULL; | |||
server_session = NULL; |
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.
But at this point, we don't want to leave dangling pointers even if we do want to retry, right? If we retry we ought to get a new server session.
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.
We should get a new session-- but to do the "is retryable" check, I need access to the FD-- which is problematic if we release the session-- since it get cleared/closed etc. With these lines removed it seems that we aren't leaking sessions (from testing locally and in our staging env).
// How many bytes have been queued to the OS for sending by haven't been sent yet | ||
// Not all platforms support this, and if they don't we'll return -1 for them | ||
virtual int64_t | ||
outstanding() |
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.
outstanding() const
outstanding_bytes
to VConnectionoutstanding_bytes
to VConnection
FreeBSD build failed! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/925/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/819/ for details. |
FreeBSD build failed! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/926/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/820/ for details. |
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/927/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/821/ for details. |
+1, assuming you are going to squash :) |
Definitely going to squash :) |
With this we can better check request retryability. This (in addition to not releasing the sessions immediately on error) means that if the request is retryable we can simply check if the number of bytes queued is the same as the number of bytes we've asked to write. If these match, then we can be sure we didn't send any ACKd packets-- meaning we are completely safe to retry.
FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/956/ for details. |
Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/848/ for details. |
With this we can better check request retryability. This (in addition to not releasing the sessions immediately on error) means that if the request is retryable we can simply check if the number of bytes queued is the same as the number of bytes we've asked to write. If these match, then we can be sure we didn't send any ACKd packets-- meaning we are completely safe to retry.