I intended to look more into this, but so far haven't been able to pick up the debugger and get at it.
I don't see anything raised on github for this, which i think is appropriate in this case. The issue is definitely at the C code level *somewhere*.
The connect method is fairly transparent:
Code: Select all
STATIC mp_obj_t socket_connect(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
struct addrinfo *res;
_socket_getaddrinfo(arg1, &res);
MP_THREAD_GIL_EXIT();
self->state = SOCKET_STATE_CONNECTED;
int r = lwip_connect(self->fd, res->ai_addr, res->ai_addrlen);
MP_THREAD_GIL_ENTER();
lwip_freeaddrinfo(res);
if (r != 0) {
mp_raise_OSError(errno);
}
return mp_const_none;
}
The only two functions that are doing anything interesting are:
Code: Select all
// ...
_socket_getaddrinfo(arg1, &res);
// ...
int r = lwip_connect(self->fd, res->ai_addr, res->ai_addrlen);
// ...
the getaddrinfo family of functions in that file result in blocking calls into the lwip library, and would be my first SWAG at where the problem is.
I don't yet know why "socket.connect" requires calling getaddrinfo, given that socket.conect is called with the results of calling socket.getaddrinfo(...) in python. I also haven't traced into lwip_connect enough to know if there's an issue there. Previously, i have traced the getaddrinfo calls down to the reasons they block, so im familiar with that code path.
So, really, a bunch of not-too-helpful information which says "raise it on github". I'd like to spend more time on it but i won't be able to do that until deep into next week at the earliest.