"pause-tube ... 0" does not handle waiting "reserve" #113

Closed
wjm2222 opened this Issue Apr 20, 2012 · 1 comment

Comments

Projects
None yet
2 participants

wjm2222 commented Apr 20, 2012

The behavior of pause-tube seems to be that a client who does a
reserve will not get a reservation until the pause interval remaining
at the time of the reserve request has expired, even if a subsequent
pause-tube shortens the delay to 0. For example:

client1> pause-tube default 86400
client2> reserve
client1> pause-tube default 0

In this example, client2 might not get a reservation until the full
86400 second delay has elapsed. However, if another client does a
reserve, it can get its reservation, and that will also wake up
client2 (in this example). So, this is what I observe:

client3> put 10 0 300 5
task1
client3> put 10 0 300 5
task2
client1> pause-tube default 86400
client2> reserve
client1> pause-tube default 0
// wait a while, and observe that client2's reserve is not served
client1> reserve
RESERVED 1 5
task1
// client2
RESERVED 2 5
task2

Note also: the latter reserve (client1) was satisfied first, but should have been second.

Owner

kr commented Apr 20, 2012

Confirmed, with the following test:

void
cttestunpausetube()
{
    int fd0, fd1;

    port = SERVER();
    fd0 = mustdiallocal(port);
    fd1 = mustdiallocal(port);

    mustsend(fd0, "put 0 0 0 0\r\n");
    mustsend(fd0, "\r\n");
    ckresp(fd0, "INSERTED 1\r\n");

    mustsend(fd0, "pause-tube default 86400\r\n");
    ckresp(fd0, "PAUSED\r\n");

    mustsend(fd1, "reserve\r\n");

    mustsend(fd0, "pause-tube default 0\r\n");
    ckresp(fd0, "PAUSED\r\n");

    // ckresp will time out if this takes too long, so the
    // test will not pass.
    ckresp(fd1, "RESERVED 1 0\r\n");
    ckresp(fd1, "\r\n");

    killsrv();
}

@kr kr closed this in 9020d9a Apr 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment