Skip to content
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

flexkvs test fail #10

Open
LanceLiu89 opened this issue Aug 24, 2020 · 2 comments
Open

flexkvs test fail #10

LanceLiu89 opened this issue Aug 24, 2020 · 2 comments

Comments

@LanceLiu89
Copy link

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
Copy link

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants