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

TS-4509: Add outstanding_bytes to VConnection #1070

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

jacksontj
Copy link
Contributor

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.

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/915/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/810/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/916/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

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()
Copy link
Contributor

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()
Copy link
Contributor

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);
Copy link
Contributor

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;
};
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

s/seession/session/

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/917/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/812/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/813/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/919/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/920/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/814/ for details.

@jacksontj
Copy link
Contributor Author

@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 :/

@atsci
Copy link

atsci commented Oct 3, 2016

Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/816/ for details.

@atsci
Copy link

atsci commented Oct 3, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/922/ for details.

Copy link
Contributor

@jpeach jpeach left a 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;
Copy link
Contributor

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.

Copy link
Contributor Author

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

outstanding() const

@jacksontj jacksontj changed the title TS-4509 Add outstanding_bytes to VConnection TS-4509: Add outstanding_bytes to VConnection Oct 4, 2016
@atsci
Copy link

atsci commented Oct 4, 2016

FreeBSD build failed! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/925/ for details.

@atsci
Copy link

atsci commented Oct 4, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/819/ for details.

@atsci
Copy link

atsci commented Oct 4, 2016

FreeBSD build failed! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/926/ for details.

@atsci
Copy link

atsci commented Oct 4, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/820/ for details.

@atsci
Copy link

atsci commented Oct 4, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/927/ for details.

@atsci
Copy link

atsci commented Oct 4, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/821/ for details.

@zwoop zwoop added the Network label Oct 4, 2016
@zwoop zwoop added this to the 7.1.0 milestone Oct 4, 2016
@jpeach
Copy link
Contributor

jpeach commented Oct 8, 2016

+1, assuming you are going to squash :)

@jacksontj
Copy link
Contributor Author

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.
@atsci
Copy link

atsci commented Oct 11, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/956/ for details.

@atsci
Copy link

atsci commented Oct 11, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/848/ for details.

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

Successfully merging this pull request may close these issues.

5 participants