Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update src/redis-benchmark.c #707

Merged
merged 1 commit into from

2 participants

@NanXiao

The code of current implementation:

if (c->pending == 0) clientDone(c);
In clientDone function, the c's memory has been freed, then the loop will continue: while(c->pending). The memory of c has been freed now, so c->pending is invalid (c is an invalid pointer now), and this will cause memory dump in some platforams(eg: Solaris).

So I think the code should be modified as:
if (c->pending == 0)
{
clientDone(c);
break;
}
and this will not lead to while(c->pending).

@NanXiao NanXiao Update src/redis-benchmark.c
The code of current implementation:

if (c->pending == 0) clientDone(c);
In clientDone function, the c's memory has been freed, then the loop will continue: while(c->pending). The memory of c has been freed now, so c->pending is invalid (c is an invalid pointer now), and this will cause memory dump in some platforams(eg: Solaris).

So I think the code should be modified as:
if (c->pending == 0)
{
clientDone(c);
break;
}
and this will not lead to while(c->pending).
9eb3a7b
@antirez
Owner

Thanks! merged.

@antirez antirez merged commit d10a01b into from
@JackieXie168 JackieXie168 referenced this pull request from a commit
@neumino neumino Update the view on server, datacenter and namespace to make it work w…
…ith the new API. Update dashboard view to keep the same model everywhere. Close #707 issue
7f1b024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 10, 2012
  1. @NanXiao

    Update src/redis-benchmark.c

    NanXiao authored
    The code of current implementation:
    
    if (c->pending == 0) clientDone(c);
    In clientDone function, the c's memory has been freed, then the loop will continue: while(c->pending). The memory of c has been freed now, so c->pending is invalid (c is an invalid pointer now), and this will cause memory dump in some platforams(eg: Solaris).
    
    So I think the code should be modified as:
    if (c->pending == 0)
    {
    clientDone(c);
    break;
    }
    and this will not lead to while(c->pending).
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/redis-benchmark.c
View
5 src/redis-benchmark.c
@@ -201,7 +201,10 @@ static void readHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
if (config.requests_finished < config.requests)
config.latency[config.requests_finished++] = c->latency;
c->pending--;
- if (c->pending == 0) clientDone(c);
+ if (c->pending == 0) {
+ clientDone(c);
+ break;
+ }
} else {
break;
}
Something went wrong with that request. Please try again.