Bug 4010 - An application using TDS is able to fill receiver's buffers and cause connection to reset
Summary: An application using TDS is able to fill receiver's buffers and cause connect...
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-21 11:14 UTC by Neale Ferguson
Modified: 2012-08-09 12:17 UTC (History)
2 users (show)

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


Attachments
Wireshark capture of packet with TCP Window Full condition (10.81 KB, text/plain)
2012-03-21 11:26 UTC, Neale Ferguson
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Neale Ferguson 2012-03-21 11:14:09 UTC

    
Comment 1 Neale Ferguson 2012-03-21 11:24:52 UTC
With the (relatively) recent improvements to buffer handling in TdsComm.cs an application is able to drive a lot of data through to the SQL Server. Depending on the nature of the load a reset packet is sometimes sent from the SQL Server side. Using Wireshark to examine the packets the attached packet is flagged by Wireshark informing that the TCP Window is full. As a result a RST packet is received from the SQL Server side shortly after and the application catches an exception. 

I note that in TdsComm client, socket.NoDelay is being set to true to disable the Nagle algorithm. I'm not sure that in very large transfers this is a desirable behavior. However, even if I disable this option the application is still able to "drown" the server in data. 

This didn't happen prior to the enhancement as the performance was slow enough that the SQL Server appears to be able to cope with the flow. Also, if an explicit delay is introduced between transmissions the problem also goes away. Might it be necessary to either:

- Turn off NOBLOCK to allow the TCP calls to block the application
- Use poll after a write to wait for the POLLOUT condition on that socket

Or is there some other mechanism that could be used?
Comment 2 Neale Ferguson 2012-03-21 11:26:46 UTC
Created attachment 1549 [details]
Wireshark capture of packet with TCP Window Full condition

A packet from a trace of the client side of a TDS session where Wireshark has detected the TCP Window Full condition. This later results in a RST packet being received from the server side causing an exception to be caught by the application.
Comment 3 Neale Ferguson 2012-08-09 12:17:28 UTC
Fixed in 8c2640437118b31b8d2033ec1da4fe0aa0ed4c5a.