tcp-acceleration-service / tas

TAS is a drop-in highly CPU efficient and scalable TCP acceleration service.
https://tcp-acceleration-service.github.io/
Other
82 stars 43 forks source link

flexkvs test fail #10

Open LanceLiu89 opened 4 years ago

LanceLiu89 commented 4 years ago

every time test flexkvs, failed at starting server will close connection right now when recv, maybe the newest test code not pushed to github when server recv data from connection, the max msg size is 128, but for request body, it need sizeof(*req) + ntohl(req->request.bodylen) at least

static inline int conn_recv(ssctx_t sc, int epfd, struct connection *c)
{
    ssize_t res;

    /* read until request is complete (or no more data) */
    do {
        res = ss_read(sc, c->fd, c->rx_buf + c->rx_len, MAX_MSGSIZE -
                c->rx_len);
        if (res == 0) {
            fprintf(stderr, "Closing connection on EOF error: %d count: %d\n", errno, MAX_MSGSIZE - c->rx_len);
            conn_close(sc, c);
            return -1;
        } else if (res < 0 && errno == EAGAIN) {
            /* request is not complete yet */
            conn_upepoll(sc, epfd, c, 0);
            return 1;
        } else if (res < 0) {
            perror("Closing connection on read error");
            conn_close(sc, c);
            return -1;
        }

        c->rx_len += res;
    } while (!conn_req_iscomp(c));

    return 0;
}

static inline int conn_req_iscomp(struct connection *c)
{
    protocol_binary_request_header *req =
            (protocol_binary_request_header *) (c->rx_buf + c->rx_off);
    uint16_t avail = c->rx_len - c->rx_off;
    if (avail < sizeof(*req)) {
        return 0;
    }

    printf("---Function: %s ---line: %d---avail: %d bodylen: %d\n", __FUNCTION__, __LINE__,avail, ntohl(req->request.bodylen));
    if (avail < sizeof(*req) + ntohl(req->request.bodylen)) {
        return 0;
    }
    return 1;
}
sarsanaee commented 3 years ago

I guess flexkvs works, I don't know if the problem is related to the TEST itself or not. I had an issue in running the flexkvs client. Eventually, we figured to started the client with a message size argument in the command line.

FreakyPenguin commented 3 years ago

Sorry missed this. Yeah this is just a matter of bad defaults. The kvs-bench client defaults to a value size of 1K (see here) but flexkvs defaults to the max message size of 128B (for header + key + value, see here). Haven't caught this because I'm always running with explicit parameters. Two options: if you want large values, increase MAX_MSGSIZE, otherwise explicitly set an appropriate value size on the client with -v. I'll make a note to change the default when I get the chance.