-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
SocketException 22 while setting ReceiveTimeout #27668
Comments
Related ADS issue microsoft/azuredatastudio#2914 |
22 is EINVAL, which maps to the "Invalid argument" the OS is giving you back (that error string comes from the OS). What is the "particular value" that's being set? Is it possible the socket has been closed? |
@stephentoub Thanks for the correction about error codes. I chatted with @kburtram offline to understand this better. I looked at the wireshark traces, it looks like, due to absence of Keep Alive settings on the Sockets, the server (or perhaps another network device) is dropping the idle connection. I know that the Keep Alive Option for Unix was added using dotnet/corefx#29963 and will be available in vNext. However is there any setting (env var) that clients, on macOS and running on .Net Core 2.1, use, to set the Keep Alive for the .Net Core application? |
You're asking if the operating system exposes an environment variable or other global configuration that would enable keep-alive by default on all sockets? Not that I'm aware of, but maybe @wfurt or @tmds knows? |
I don't think there is env variable. Most systems do have option to tune this globally.
The close should pop up if we try to read from the socket. |
Thanks @wfurt |
I got an error report from a product which uses SqlClient from .Net Core on macOS
The stack shows a SocketException with code 22 when SqlClient is setting the Socket timeout for receive to a particular value.
My ask is what does the error code 22 for SocketException mean and in what scenarios can it be thrown? And how should this error be handled in case of setting the timeout?
While reading the code, I found that the error could be
EFBIGEINVALID from https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/Native/Unix/System.Native/pal_errno.c#L67EFBIGis thrown when the size of file being written is too large. However in this case, a timeout is being set on the socket, and no large amount of data is being written to the socket. ~~cc @kburtram
EDIT: The error code is EINVAL.
The text was updated successfully, but these errors were encountered: