Bug #1139


lighty 1.5.x-svn + mod_magnet + luasockets + memcached: SIGSEGV crash

Added by Terminar about 16 years ago. Updated about 14 years ago.

Target version:


Lighty doesn't like that combination. It seems that on socket connect, lighty crashes.
Here is a small strace.log

17:09:15.183785 rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_IGN}, 8) = 0
17:09:15.184030 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 12
17:09:15.184092 fcntl64(12, F_GETFL)    = 0x2 (flags O_RDWR)
17:09:15.184135 fcntl64(12, F_SETFL, O_RDWR|O_NONBLOCK) = 0
17:09:15.184182 gettimeofday({1177340955, 184201}, NULL) = 0
17:09:15.184233 connect(12, {sa_family=AF_INET, sin_port=htons(11211), sin_addr=inet_addr("XXXXXXXXXXXXXXXXX")}, 16) = -1 EINPROGR
ESS (Operation now in progress)
17:09:15.184337 select(13, [12], [12], NULL, NULL) = 1 (out [12])
17:09:15.199262 gettimeofday({1177340955, 199293}, NULL) = 0
17:09:15.199319 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
17:09:15.199357 +++ killed by SIGSEGV +++


Memcached.lua (5.48 KB) Memcached.lua lua Memcached module Terminar, 2007-04-23 18:05
physical.lua (133 Bytes) physical.lua test magnet Terminar, 2007-04-23 18:05
lighttpd.valgrind (15.6 KB) lighttpd.valgrind Terminar, 2007-04-23 18:12
lighttpd.28633 (66.6 KB) lighttpd.28633 tx, 2007-07-20 10:57
lighttpd.trace (126 KB) lighttpd.trace strace tx, 2007-07-20 10:57
bt.txt.txt (837 Bytes) bt.txt.txt tx, 2007-07-20 11:08
bt-full.txt.txt (1.6 KB) bt-full.txt.txt tx, 2007-07-20 11:09
bt-luasocket-debug.txt.txt (1.43 KB) bt-luasocket-debug.txt.txt tx, 2007-07-20 12:17

Related issues 1 (0 open1 closed)

Is duplicate of Bug #1843: luasockets and lightys buffer_init are not prefixedWontfix2008-12-12Actions
Actions #1

Updated by Terminar about 16 years ago

I'm trying to find the exact reason for the sigsegv, it is not the connect, but the first call to functions like add, set, get. If i have more details i'll add them here

Actions #2

Updated by Terminar about 16 years ago

Ok, it doesn't seem to be in the Connect, crash happenes when socket:send is used,,, I have attached the Memcache module the testfile i used as "magnet" and the valgrind output. You need to install luasocket to use this.

Actions #3

Updated by tx almost 16 years ago

i have this problem too see atached valgrind and strace

Actions #4

Updated by tx almost 16 years ago

in addition with some peoples on irc we made additional tests with
stand alone lua and luasocket

works like charm

Actions #5

Updated by moo almost 16 years ago

reformat desc

Actions #6

Updated by Anonymous over 15 years ago

That is obviously not a lighttpd bug. In fact memcache.lua uses luasockets. Luasockets has a buffer_init function that is called when sending data. Unfortunatly lighty also has a buffer_init method which overwrites luasocket's buffer_int method. Therefore the buffer get's not initialized correct and when the process tries to access buf->tm it fails with a null pointer (sigsegv).

In my opinion that is not a lighttpd bug, but in fact is a result of bad naming in luasockets as a library should at least prefix it's exported methods.

I suggest to close this ticket.

-- sn_

Actions #7

Updated by Anonymous almost 15 years ago

And now ? What is the solution ?

Actions #8

Updated by stbuehler about 14 years ago

  • Status changed from New to Wontfix
  • Patch available set to No

See #1843

Actions #9

Updated by darix about 14 years ago

this needs a patch in lua or renaming our function


Also available in: Atom