Quantcast

Curious behaviour in gen_tcp, an update... Possible bug in erts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Curious behaviour in gen_tcp, an update... Possible bug in erts

Alexis Le-Quoc
In erts/emulator/drivers/common/inet_drv.c:4026, there is a call to
tcp_recv(desc, n).

/*********************************/
if (tcp_recv(desc, n) == 0) {
    if (timeout == 0)
        async_error_am(INETP(desc), am_timeout);
    else {
        if (timeout != INET_INFINITY)
            driver_set_timer(desc->inet.port, timeout);
        sock_select(INETP(desc),(FD_READ|FD_CLOSE),1);
}

return ctl_reply(INET_REP_OK, tbuf, 2, rbuf, rsize);
/*********************************/

The problem is that tcp_recv() can return -1 if the buf allocation (line
4518) fails, which happens when I try to read megabytes of data through the
socket, using binaries.

I don't have a patch available, but I suspect that adding a test for
tcp_recv would be a fix, as well as the appropriate error/clean-up handler.
I can provide test cases if requested (erlang and python). Also, I'm
referring to the latest source code R7B-1.

Cheers,

Alexis





Loading...