Bug 52579 - Request stream copying seems to be corrupting socket communication
Summary: Request stream copying seems to be corrupting socket communication
Status: NEEDINFO
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-02-16 18:15 UTC by Jérémie Laval
Modified: 2017-12-11 21:55 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Jérémie Laval 2017-02-16 18:15:52 UTC
Still trying to NuGet push working on Mono (see https://github.com/NuGet/Home/issues/3251#issuecomment-278543504)

With https://github.com/mono/mono/commit/4393b684526a78da6b9d5d45b82758e23676da57 in, the push operation works under those two scenarios:

- Pushing a small package (2.6K)
- Pushing any package when routing via an http proxy (Charles)

However, when I try to push a more consequent package (5.4M) I get this kind of transaction (logging added to main NuGet binary): https://gist.github.com/garuma/e75dc824c57435990b88c0004d4e2e82

It *seems* that somehow when pushing the bigger package, something is writing to the socket after the initial request has been refused by the server which triggers a 400 Bad Request because it can't recognize the verb used indicating possible corruption.

Based on a suggestion from Ludovic, I changed the code to request the HTTP connection to be closed after an exchange and now I get an ObjectDisposedException exception in the transaction: https://gist.github.com/garuma/bcea2ac128e4687e42ffaf7cc8f3d509

This exception make it looks like the content stream copying that is occurring in https://github.com/mono/mono/blob/master/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs#L379 is not taking the lifetime of the http conversation into account and continue writing to the underlying socket which, in this case, ends up throwing an ODE because of it.
Comment 1 Marek Safar 2017-02-28 15:15:38 UTC
We'd need some sort of repro as that code is quite complicated
Comment 2 Mikayla Hutchinson [MSFT] 2017-07-17 18:39:24 UTC
See also https://bugzilla.xamarin.com/show_bug.cgi?id=44027, which has a repro.
Comment 3 Martin Baulig 2017-12-11 21:55:47 UTC
Possible duplicate of #44027 - do you still see this problem?

Note You need to log in before you can comment on or make changes to this bug.