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

EXC_BAD_ACCESS when trying to get key type before any access #19

Closed
GoogleCodeExporter opened this issue Nov 3, 2015 · 6 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Make a simple C program to get the type of a key using credis_type(rh, 
"mykey")

What is the expected output? What do you see instead?

I expect to retrieve the type of the key that I'm querying. Instead, I get 
EXC_BAD_ACCESS. 
However, if I credis_get() a string key first, I am able to get the type 
successfully.


What version of the product are you using? On what operating system?
credis 0.2.1
Mac OS X 10.6


Please provide any additional information below.

Original issue reported on code.google.com by wes...@gmail.com on 11 May 2010 at 3:30

@GoogleCodeExporter
Copy link
Author

The EXC_BAD_ACCESS is from xcode. I get a segmentation fault when running in 
terminal.


Original comment by wes...@gmail.com on 12 May 2010 at 1:34

Attachments:

@GoogleCodeExporter
Copy link
Author

I haven't been able to try this myself but do you think it is a problem in 
Credis? 
Could be something in the Redis server, have you tried with other client libs 
if the 
same error is returned?

Original comment by romf...@gmail.com on 12 May 2010 at 5:05

@GoogleCodeExporter
Copy link
Author

Hi romfelt,

I just tried it with Ezra's  ruby library. I was able to successfully query a 
key's type like so:

require 'redis'
r = Redis.new
r.type 'mykey'
=> "string"

So yes, unfortunately I think it's a problem with credis. I am trying to debug 
it now, but I'm not that much of a 
C guru.

It seems like the problem stems from like #778:

char *t = rhnd->reply.bulk;

*t is coming back null. Hope this helps some. I'll continue to try my luck at 
debugging it, but I really doubt I 
can. Thanks for all your work on credis!

Original comment by wes...@gmail.com on 12 May 2010 at 5:20

@GoogleCodeExporter
Copy link
Author

One other note of interest: whenever I use the credis_type() function, it is 
altering the value of the previous key.

For example:

This returns the value just fine, as expected:.

char *val;
credis_get(rh, "mykey", &val);
printf("mykey: %s", val);

However, this will alter mykey's value:

char *val;
credis_get(rh, "mykey", &val);
type = credis_type(rh, "mykey");
printf("value: %s -- type: %s", val, type);

Hope this helps some...

Original comment by wes...@gmail.com on 12 May 2010 at 5:43

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision r28.

Original comment by romf...@gmail.com on 12 May 2010 at 7:08

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

found a bug. used reply bulk instead of reply line. this resulted in 
segmentation fault 
when credis_type() was the first function used since reply bulk was 
uninitialized and 
by mistakingly used.

Original comment by romf...@gmail.com on 12 May 2010 at 7:11

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

No branches or pull requests

1 participant