Hi, 

I have a situation where a DTrace script is printing out extra characters, 
despite the copyin() call giving a specific length.  Can anyone think of why 
this might be?  It's fine the first time all of the probes fire, but on a 
second run of my generating operations, I get junk in there.  For example:

set setop length 5, FOUND KEY, STORED
set setop length 5, FOUND KEY, STORED
get setop, FOUND KEY
get nothere, NOT FOUND
add addop, NOT FOUND
add addop, NOT FOUND
set replaceop length 9, FOUND KEY, STORED
replace replaceop, FOUND KEY
set anumber length 7, FOUND KEY, STORED
incr anumber, FOUND KEY, 101
decr anumber, FOUND KEY, 100

set setopceoreplaceop length 5, FOUND KEY, STORED
set setop length 5, FOUND KEY, STORED
get setop, FOUND KEY
get nothere, NOT FOUND
add addop, NOT FOUND
add addop, NOT FOUND
set replaceopnumber length 9, FOUND KEY, STORED
replace replaceop, FOUND KEY
set anumber length 7, FOUND KEY, STORED
incr anumber, FOUND KEY, 101
decr anumber, FOUND KEY, 100

I should see exactly the same output, but for some reason... even though the 
length is 5 on that first set the second time through, I get far more than 5 
characters.  If I stop and restart the DTrace script, I get good output the 
first time.  This is on OpenSolaris 2009.06.

This is quite easy to reproduce.

The script is the following, where arg1 is not a string but a pointer to the 
key from the command and arg2 is the length of that key.  

memcached*::command-get
/ (signed int) arg3 != -1 /
{
  printf("get %s, FOUND KEY\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-get
/ (signed int) arg3 == -1 /
{
  printf("get %s, NOT FOUND\n", stringof(copyin(arg1, arg2)));
}


memcached*::command-add
/ (signed int) arg3 != -1 /
{
  printf("add %s, FOUND KEY\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-add
/ (signed int) arg3 == -1 /
{
  printf("add %s, NOT FOUND\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-replace
/ (signed int) arg3 != -1 /
{ 
  printf("replace %s, FOUND KEY\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-replace 
/ (signed int) arg3 == -1 /
{ 
  printf("replace %s, NOT FOUND\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-set
/ (signed int) arg3 != -1 /
{ 
  printf("set %s length %d, FOUND KEY, STORED\n", 
          stringof(copyin(arg1, arg2)), arg2);
}

memcached*::command-set
/ (signed int) arg3 == -1 /
{ 
  printf("set %s, NOT FOUND, STORED\n", stringof(copyin(arg1, arg2)));
}

memcached*::command-incr
{
  printf("incr %s, FOUND KEY, %d\n", stringof(copyin(arg1, arg2)), arg3);
}

memcached*::command-decr
{ 
  printf("decr %s, FOUND KEY, %d\n", stringof(copyin(arg1, arg2)), arg3);
}


Thanks in advance!

- Matt
-- 
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to