[CSHARP-1454] SocketTimeout not honored with Async reads Created: 19/Oct/15  Updated: 04/Feb/18  Resolved: 18/Nov/15

Status: Closed
Project: C# Driver
Component/s: Connectivity
Affects Version/s: 2.0.1, 2.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Brian Anderton Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Depends
depends on CSHARP-1448 Create sync versions of the new 2.x APIs Closed
Related
is related to CSHARP-775 Tailable cursor blocks forever when c... Closed

 Description   

As a workaround to the infinite hanging on tailable cursors during an Azure VIP swap, CSHARP-775 suggests to change SocketTimeout. But it appears that this is no longer working with 2.x Async driver as the code merely sets the ReadTimeout of the underlying NetworkStream, which is ignored for Async reads. (see https://msdn.microsoft.com/en-us/library/bk6w7hs8%28v=vs.110%29.aspx which indicates: "This property does not affect asynchronous reads performed by calling the BeginRead method").

It appears the Async Connection code manually sets a timer to apply the a connection timeout, but does not do anything similar for async reads. Thus the SocketTimeout setting seems to be completely broken at the moment.



 Comments   
Comment by Craig Wilson [ 18/Nov/15 ]

We introducing a sync stack into the 2.2 driver which will honor this setting. Since this is a documented "feature" of async sockets, we are going to leave this alone.

Comment by Craig Wilson [ 19/Oct/15 ]

Hi Brian,

As I stated in a comment in CSHARP-775, async sockets simply don't obey these settings. We'll be introducing a sync stack back into driver version 2.2 which will start honoring these settings again.

Craig

Generated at Wed Feb 07 21:39:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.