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

i hava got a problem in function "sdsMakeRoomFor" #110

Closed
monRedis opened this issue Jun 21, 2012 · 10 comments
Closed

i hava got a problem in function "sdsMakeRoomFor" #110

monRedis opened this issue Jun 21, 2012 · 10 comments

Comments

@monRedis
Copy link

when i use hiredis,i get a problem in function sdsMakeRoomFor.this problem does't accre frequently,only sometimes. follow is this coredump partly,why this is cause? can you tell me how to fix it?
#0 0x007c2854 in SLL_Next(void*) () from /usr/local/lib/libtcmalloc.so.0
#1 0x007c28ad in SLL_Pop(void**) () from /usr/local/lib/libtcmalloc.so.0
#2 0x007c70a5 in TCMalloc_ThreadCache_FreeList::Pop() ()

from /usr/local/lib/libtcmalloc.so.0
#3 0x007c8344 in TCMalloc_ThreadCache::Allocate(unsigned int) ()

from /usr/local/lib/libtcmalloc.so.0
#4 0x007c682b in do_malloc(unsigned int) ()

from /usr/local/lib/libtcmalloc.so.0
#5 0x007e60ed in realloc () from /usr/local/lib/libtcmalloc.so.0
#6 0x001371f5 in sdsMakeRoomFor (s=0x0, t=0x8744564, len=6) at sds.c:97
#7 sdscatlen (s=0x0, t=0x8744564, len=6) at sds.c:131
#8 0x00134f72 in redisvFormatCommand (target=0xb7504d9c,

format=0x805a07e "HSET %s %s %s",
ap=0xb7504e18 "dEt\b\354\207\360\t\334\033u\b\377\377\377\377HNP\267\217\f\0                                                                                       05\b`\263\344\b14207") at hiredis.c:738

#9 0x001353bf in redisvAppendCommand (c=0x8755dc0,

format=0x805a07e "HSET %s %s %s",
ap=0xb7504e18 "dEt\b\354\207\360\t\334\033u\b\377\377\377\377HNP\267\217\f\0                                                                                       05\b`\263\344\b14207") at hiredis.c:1199

#10 0x00136fe0 in redisvCommand (c=0x8755dc0,

format=0x805a07e "HSET %s %s %s",
ap=0xb7504e18 "dEt\b\354\207\360\t\334\033u\b\377\377\377\377HNP\267\217\f\0                                                                                       05\b`\263\344\b14207") at hiredis.c:1266

#11 0x0013704e in redisCommand (c=0x8755dc0, format=0x805a07e "HSET %s %s %s")

at hiredis.c:1275

#12 0x08054704 in CRedisImplCommond::ImplCommondHashSet (this=0x874daf4,

key=0x8744564 "DJY001", value=0x8751bdc "namename|123456|online|10")
@goelvivek
Copy link

hi,
Any update here ?
I am getting same issue

Program terminated with signal 11, Segmentation fault.
#0 0x00007f71b5d43693 in malloc_consolidate.part.3 () from /lib64/libc.so.6
#0 0x00007f71b5d43693 in malloc_consolidate.part.3 () from /lib64/libc.so.6
#1 0x00007f71b5d44b28 in _int_malloc () from /lib64/libc.so.6
#2 0x00007f71b5d463aa in _int_realloc () from /lib64/libc.so.6
#3 0x00007f71b5d47d46 in realloc () from /lib64/libc.so.6
#4 0x00007f71bad0dc2a in sdsMakeRoomFor (s=, t=0x7f71943225a0, len=405) at sds.c:97
#5 sdscatlen (s=, t=0x7f71943225a0, len=405) at sds.c:131
#6 0x00007f71bad0b1d0 in __redisAppendCommand (c=0x7f71940038c0, cmd=, len=) at hiredis.c:1186
#7 0x00007f71bad0bef7 in redisvAppendCommand (c=0x7f71940038c0, format=, ap=) at hiredis.c:1206
#8 0x00007f71bad0bfd8 in redisAppendCommand (c=, format=) at hiredis.c:1220

@pietern
Copy link
Contributor

pietern commented Jun 11, 2013

Both of these traces look like they are caused by something in the allocator; tcmalloc in the top one, and the libc allocator in the bottom one. It is more likely that you have bad memory rather than this being a bug in the allocator code. You can check the memory on your machine with memcheck, or with the built-in memory checker in Redis.

Execute it with: redis-server --test-memory.

@goelvivek
Copy link

But I got 3 crashes in last 2 days on 3 different machines. It was working
fine earlier from 6 months.
Note: I got crash in redis client hiredis.
The command you have given seems to be for server. Will firing that
command help ?

regards
Vivek Goel

On Tue, Jun 11, 2013 at 9:18 PM, Pieter Noordhuis
[email protected]:

Both of these traces look like they are caused by something in the
allocator; tcmalloc in the top one, and the libc allocator in the bottom
one. It is more likely that you have bad memory rather than this being a
bug in the allocator code. You can check the memory on your machine with
memcheck, or with the built-in memory checker in Redis.

Execute it with: redis-server --test-memory.


Reply to this email directly or view it on GitHubhttps://github.com//issues/110#issuecomment-19270665
.

@pietern
Copy link
Contributor

pietern commented Jun 11, 2013

You should run that command on the machines where the crash happened, not on the server.

It doesn't look like hiredis itself is the problem here; the crash is caused by the allocator.

@monRedis
Copy link
Author

thanks,i have solved it

2013/6/12 Pieter Noordhuis [email protected]

You should run that command on the machines where the crash happened, not
on the server.

It doesn't look like hiredis itself is the problem here; the crash is
caused by the allocator.


Reply to this email directly or view it on GitHubhttps://github.com//issues/110#issuecomment-19280678
.

@pietern
Copy link
Contributor

pietern commented Jun 26, 2013

How did you solve it in the end? What was the cause for these crashes?

@pietern pietern closed this as completed Jun 26, 2013
@andoryu-
Copy link

I ran into basically the same issue(apart from the fact that glibc is used instead of tcmalloc), which turned out to be a normal heap corruption bug. If the segfault happened randomly at any place using malloc, don't blame hiredis.(Although hiredis uses realloc a lot, which makes it more likely to trigger the problem)

@Denny007
Copy link

@monRedis
I have the same issue, would you tell me how to fix it

@sambk
Copy link

sambk commented Mar 20, 2019

Hi monRedis and Denny007,
I also have the same issue. Could you share your experience how to solve the problem?

@sambk
Copy link

sambk commented Apr 4, 2019

For those who have the same issue, I have fixed my problem. The answer is that the cause is my own memory bug not related to hiredis lib. Perhaps hiredis use many dynamic allocations, the program is prone to crash inside it.

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

6 participants