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

Patch on redirected repo fails #874

Closed
Red-Folder opened this issue Aug 28, 2015 · 12 comments
Closed

Patch on redirected repo fails #874

Red-Folder opened this issue Aug 28, 2015 · 12 comments
Labels
Type: Bug Something isn't working as documented

Comments

@Red-Folder
Copy link
Contributor

This is being picked up by the integration test: Octokit.Tests.Integration.RedirectTests.CanCreateIssueOnRedirectedRepository

The test runs until it tries to update the issue.

From stepping through:

  • The patch to the original repo is sent and a redirect is received (as expected)
  • The new request (against the new repo) is created and submitted. This then sits on "var response = await base.SendAsync(request, cancellationToken);" until we get an exception that the task was cancelled (I assume timeout).

It looks like the new request doesn't have its content set-up correctly.

I'll have more of a dig when I get a chance, but wanted to post while still fresh in my head.

@Red-Folder
Copy link
Contributor Author

Seems to be something odd ...

If I run from VS, it seems to time out on the send of the new request (following the redirect).

Yet, I run Fiddler, and it all works. Disable Fiddler Traffic Capture and it times out. Re-enable and it works.

@Red-Folder
Copy link
Contributor Author

@shiftkey Any thoughts on this? Do you see the same problem?

@shiftkey
Copy link
Member

@Red-Folder digging my way out from under a heap of psychic debt at the moment, so i'm not quite sure when I'll get to investigating this. But thanks for reporting it!

@hnrkndrssn
Copy link
Contributor

I can confirm I'm seeing the same thing as @Red-Folder, running the test in VS fails with a timeout. Start Fiddler, then run the test in VS and the test passes. I'll see if I can dig a bit deeper and figure out what is going on.

@shiftkey
Copy link
Member

Bumping this and opening it up for investigating, because I've seen it while testing #989

@shiftkey shiftkey added the bug label Dec 14, 2015
@Red-Folder
Copy link
Contributor Author

@shiftkey Sorry - I didn't get much further in my investigation than noted above.

I seem to remember that I felt it was something to do with a connection being held open and it causing blocking (maybe some reference not being released correctly) - but it is likely to be something quite low level if the problem "disappears" when Fiddler is involved.

I have no scientific proof for my theory ;)

I'll have a another go when I get a chance (maybe wireshark or something similar will be less obtrusive than Fiddler and give some indication if the connection is still open)

@shiftkey
Copy link
Member

@Red-Folder it's all good. I wish I had a better answer for you about what might be happening but I've got many Windmills™ to Tilt At™* at the moment...

* citation

@Red-Folder
Copy link
Contributor Author

Ok, update on progress. I'm using an old version of the code (not pulled for about 3 months) ... but can recreate the problem for the Octokit.Tests.Integration.RedirectTests.CanCreateIssueOnRedirectedRepository test.

As originally, if I run the test from VS, it hangs/ times out. Yes if I run with Fiddler, then I have no problem.

So I've run with Wireshark ... I've included a summary below (good luck to anyone that can understand it). From what I guess, it appears to have 2 TSL requests (which we'd expect) the handshakes, setup etc all seem fine.

However with both, api.github.com are providing in FIN/ ACK - which is closing the connection.

Then some time later, we get the RST/ ACK from the client (for some reason I have my laptop set up as www.x.com) - this seems to be the timeout.

I wonder if something is going wrong with the HTTPClient not correctly handling the FIN/ ACK.

Equally, I could be heading down the wrong rabbit hole.

Wireshark summary:

No. Time Source Destination Protocol Length Info
12084 20.266681 www.x.com api.github.com TCP 51068 → https [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
12383 20.389320 api.github.com www.x.com TCP https → 51068 [SYN, ACK] Seq=0 Ack=1 Win=28720 Len=0 MSS=1436 SACK_PERM=1 WS=1024
12384 20.389436 www.x.com api.github.com TCP 51068 → https [ACK] Seq=1 Ack=1 Win=66048 Len=0
12386 20.390796 www.x.com api.github.com TLSv1 Client Hello
12423 20.505202 api.github.com www.x.com TLSv1 Server Hello
12424 20.506190 api.github.com www.x.com TLSv1 Certificate
12425 20.506252 www.x.com api.github.com TCP 51068 → https [ACK] Seq=127 Ack=2873 Win=66048 Len=0
12426 20.506303 api.github.com www.x.com TLSv1 Server Key Exchange
12427 20.509106 www.x.com api.github.com TLSv1 Client Key Exchange, Change Cipher Spec, Encrypted Handshake Message
12433 20.620525 api.github.com www.x.com TLSv1 Change Cipher Spec, Encrypted Handshake Message
12434 20.622086 www.x.com api.github.com TLSv1 Application Data
12443 20.735373 api.github.com www.x.com TCP https → 51068 [ACK] Seq=3085 Ack=826 Win=31744 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
12444 20.735793 api.github.com www.x.com TLSv1 Application Data
12445 20.736676 www.x.com api.github.com TLSv1 Application Data
12477 20.883513 api.github.com www.x.com TCP https → 51068 [ACK] Seq=3138 Ack=927 Win=31744 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
12478 20.893246 api.github.com www.x.com TLSv1 Application Data
12479 20.896213 www.x.com api.github.com TCP 51074 → https [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1
12493 20.944785 www.x.com api.github.com TCP 51068 → https [ACK] Seq=927 Ack=4327 Win=66048 Len=0
12574 21.033572 api.github.com www.x.com TCP https → 51074 [SYN, ACK] Seq=0 Ack=1 Win=28720 Len=0 MSS=1436 SACK_PERM=1 WS=1024
12575 21.033654 www.x.com api.github.com TCP 51074 → https [ACK] Seq=1 Ack=1 Win=66048 Len=0
12582 21.034242 www.x.com api.github.com TLSv1 Client Hello
12911 21.208703 api.github.com www.x.com TLSv1 Server Hello, Change Cipher Spec, Encrypted Handshake Message
12918 21.210139 www.x.com api.github.com TLSv1 Change Cipher Spec, Encrypted Handshake Message, Application Data
13262 21.361958 api.github.com www.x.com TCP https → 51074 [ACK] Seq=146 Ack=735 Win=31744 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
13263 21.361995 api.github.com www.x.com TLSv1 Application Data
13264 21.362275 www.x.com api.github.com TLSv1 Application Data
13626 21.524183 api.github.com www.x.com TCP https → 51074 [ACK] Seq=199 Ack=836 Win=31744 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
13781 21.640681 api.github.com www.x.com TLSv1 Application Data
13782 21.641520 api.github.com www.x.com TLSv1 Application Data
13783 21.641586 www.x.com api.github.com TCP 51074 → https [ACK] Seq=836 Ack=2993 Win=66048 Len=0
13784 21.641929 api.github.com www.x.com TLSv1 Application Data
13798 21.684186 www.x.com api.github.com TLSv1 Application Data
13804 21.796589 api.github.com www.x.com TCP https → 51074 [ACK] Seq=3158 Ack=1273 Win=32768 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
13813 21.899594 api.github.com www.x.com TLSv1 Application Data
13814 21.901602 api.github.com www.x.com TLSv1 Application Data
13815 21.901795 www.x.com api.github.com TCP 51074 → https [ACK] Seq=1273 Ack=4880 Win=66048 Len=0
13816 21.915542 www.x.com api.github.com TLSv1 Application Data
13838 22.029272 api.github.com www.x.com TCP https → 51074 [ACK] Seq=4880 Ack=1822 Win=33792 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
13839 22.029363 api.github.com www.x.com TLSv1 Application Data
13840 22.029761 www.x.com api.github.com TLSv1 Application Data
13865 22.179555 api.github.com www.x.com TCP https → 51074 [ACK] Seq=4933 Ack=1955 Win=34816 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]
13866 22.182841 api.github.com www.x.com TLSv1 Application Data
13981 22.233155 www.x.com api.github.com TCP 51074 → https [ACK] Seq=1955 Ack=6122 Win=64768 Len=0
24010 30.907642 api.github.com www.x.com TLSv1 Encrypted Alert
24011 30.907692 api.github.com www.x.com TCP https → 51068 [FIN, ACK] Seq=4364 Ack=927 Win=31744 Len=0
24012 30.907732 www.x.com api.github.com TCP 51068 → https [ACK] Seq=927 Ack=4365 Win=65792 Len=0
25679 32.192455 api.github.com www.x.com TLSv1 Encrypted Alert
25680 32.192795 api.github.com www.x.com TCP https → 51074 [FIN, ACK] Seq=6159 Ack=1955 Win=34816 Len=0
25681 32.192840 www.x.com api.github.com TCP 51074 → https [ACK] Seq=1955 Ack=6160 Win=64768 Len=0
59738 121.915049 www.x.com api.github.com TCP 51074 → https [RST, ACK] Seq=1955 Ack=6160 Win=0 Len=0
59749 122.845391 www.x.com api.github.com TCP 51068 → https [RST, ACK] Seq=927 Ack=4365 Win=0 Len=0

@daveaglick
Copy link
Contributor

I'm seeing this too, including the odd behavior that it works when Fiddler is open. I thought I was going crazy. It's happening for me on calls to GitHubClient.Issue.GetAllForRepository() - anytime the repo has been redirected, the call hangs and then eventually times out.

ryangribble added a commit to TattsGroup/octokit.net that referenced this issue Aug 10, 2016
ryangribble added a commit to TattsGroup/octokit.net that referenced this issue Aug 10, 2016
…se it later

Now the skipped test from octokit#874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
ryangribble added a commit to TattsGroup/octokit.net that referenced this issue Aug 10, 2016
…se it later

Now the skipped test from octokit#874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
ryangribble added a commit to TattsGroup/octokit.net that referenced this issue Aug 10, 2016
…se it later

Now the skipped test from octokit#874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
martinscholz83 pushed a commit to martinscholz83/octokit.net that referenced this issue Aug 11, 2016
…se it later

Now the skipped test from octokit#874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
ryangribble pushed a commit that referenced this issue Aug 14, 2016
* add test

* [WIP]

* put logic for redirects outside of delegating handler

* change send method

* format code

* reorganized http client adapter

* change HttpClientAdapter

* rework http redirect tests - still an issue with accessing the response.RequestMessage.Content property as it is disposed

* remove some unused lines in httpclientadapter

* Reworked redirect implementation to fully clone http request and re-use it later
Now the skipped test from #874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
@Red-Folder
Copy link
Contributor Author

This is a bit of a drive-by ... spotted this article about the use of HttpClient -> http://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

This feels as if it may be related to this problem.

Not had a chance to run through the code (and not likely to in the near future) ... but figured I'd throw this in while passing. Hope it helps.

@ryangribble
Copy link
Contributor

Thanks for the bump and reference, this has actually been fixed by changes in #1411 and the failing test has been unskipped, looks like I forgot to come back and close this 😀

@Red-Folder
Copy link
Contributor Author

@ryangribble Excellent news. Great stuff

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented and removed category: bug labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

6 participants