Bug #1139

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

Added by Terminar 625 days ago. Updated 170 days ago.

Status:New Start:
Priority:Normal Due date:
Assigned to:jan % Done:

0%

Category:mod_magnet
Target version:1.5.0
Pending:

No

Resolution:


Description

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 - lua Memcached module (5.5 KB) Terminar, 04/23/2007 06:05 PM

bt-full.txt.txt (1.6 KB) tx, 07/20/2007 11:09 AM

bt-luasocket-debug.txt.txt (1.4 KB) tx, 07/20/2007 12:17 PM

bt.txt.txt (837 Bytes) tx, 07/20/2007 11:08 AM

lighttpd.28633 (66.6 KB) tx, 07/20/2007 10:57 AM

lighttpd.trace - strace (125.9 KB) tx, 07/20/2007 10:57 AM

lighttpd.valgrind (15.6 KB) Terminar, 04/23/2007 06:12 PM

physical.lua - test magnet (133 Bytes) Terminar, 04/23/2007 06:05 PM

History

04/23/2007 05:09 PM - Terminar

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

04/23/2007 06:28 PM - Terminar

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.

07/20/2007 10:58 AM - tx

i have this problem too see atached valgrind and strace

07/20/2007 11:48 AM - tx

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

works like charm

07/20/2007 02:33 PM - moo

reformat desc

01/22/2008 08:10 AM - Anonymous

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_

07/21/2008 07:50 AM - Anonymous

And now ? What is the solution ?

Also available in: Atom PDF