Tue 12 Jun 2007 06:45:13 AM UTC, comment #9:
Ok, and thank you to report that...
|
Tue 12 Jun 2007 12:11:54 AM UTC, comment #8:
Yes we can close this item. I'm getting ECONNABORTED error.
-Srinivas.
|
Mon 11 Jun 2007 09:20:53 PM UTC, comment #7:
No sure to understand: so, now, do you got a ECONNABORTED error, or EIO ? If it's ECONNABORTED, I think it's normal, and we can close this item. Can you confirm?
|
Mon 11 Jun 2007 08:46:47 PM UTC, comment #6:
Yes, err_tcp() gets invoked upon keep-alive timeout and sets ERR_ABRT for that connection. I do not have the fix for the err_to_errno() macro, with that update i get ECONNABORTED error.
Thanks.
-Srinivas.
|
Mon 11 Jun 2007 08:18:37 PM UTC, comment #5:
I have check in like said in comment #4...
|
Mon 11 Jun 2007 06:12:08 PM UTC, comment #4:
Is there any objects to change getsockopt(SO_ERROR) like this ?
case SO_ERROR:
if (sock->err==0) {
sock_set_errno(sock, err_to_errno(sock->conn->err));
}
(int )optval = sock->err;
sock->err = 0;
|
Mon 11 Jun 2007 05:25:03 PM UTC, comment #3:
If I believe the tcp_abort code (call by the keepalive timeout code), you should got a ERR_ABRT error :
TCP_EVENT_ERR(errf, errf_arg, ERR_ABRT);
ERR_ABRT is matching to ECONNABORTED in err_to_errno_table.
I really would like to see your trace with "err" values. Can you display them and send us?
|
Mon 11 Jun 2007 04:29:06 PM UTC, comment #2:
(please, answer by the bug tracker to get a trace)
>Yup, the fix works good with a small correction.
>sock_set_errno(sock, err_to_errno(sock->conn->err)); /* PATCH
>note: sock->conn->err instead of conn->err*/
Yes you're right. Can you also confirm that err_tcp is called?
>But the returned socket error is EIO (0x5) which seems to be inconsistent with the error values returned by the standard getsockopt() error values. I guess we have to return EINVAL if connection is closed.
>http://compute.cnr.berkeley.edu/cgi-bin/man-cgi?getsockopt+3
There is a table to match lwip error code with BSD error code (at the beginning of sockets.c file). In this table, you could see:
EIO, /* ERR_ARG -8 Illegal argument. */
Perhaps, if you display the "err" field in err_tcp(), perhaps the code is ERR_ARG. One other possibility is that the "err" code is not "inside" the err_to_errno_table (in such case, EIO seems to be the value). Can you display err from err_tcp, and sock->conn->err, and tell me your values?
|
Mon 11 Jun 2007 02:40:45 PM UTC, comment #1:
I think that conn->err is set to an error value (I suppose that err_tcp in api_msg.c is called, put a trace here to be sure).
But sock->err is not change until next send, recv, etc...
Perhaps you can test to patch sockets.c like this:
case SO_ERROR:
if (sock->err==0) {
sock_set_errno(sock, err_to_errno(conn->err)); /PATCH/
}
(int )optval = sock->err;
sock->err = 0;
Like this, you should keep the first error. Tell me if you got the trace in err_tcp, and if just patch is good for you...
|
Mon 11 Jun 2007 02:10:43 PM UTC, original submission:
socket error(sock->err) is not being set if connection is closed at the TCP level.
For example if keep-alive timer is enabled and timer expires we close the connection in tcp_slowtmr()/tcp_abort(). Socket layer is not aware of the closed connection. If application queries with getsockopt()/SO_ERROR option are'nt we suppose to return error(EINVAL?) if conn->err is set for the socket?
-Srinivas.
|