Hi Volker,<br><br>I forward your request to the user list since I don&#39;t currently have much time to process it.<br>quickly testing 2.4.1, I wasn&#39;t able to reproduce it.<br><br>a question: was it working with the exact same context/config with 2.2.2?<br>
<br>cheers,<br>Arnaud<br>-- <br>Linux / Unix Expert R&amp;D - Eaton - <a href="http://www.eaton.com/mgeops">http://www.eaton.com/mgeops</a><br>Network UPS Tools (NUT) Project Leader - <a href="http://www.networkupstools.org/">http://www.networkupstools.org/</a><br>
Debian Developer - <a href="http://people.debian.org/~aquette/">http://people.debian.org/~aquette/</a><br>Free Software Developer - <a href="http://arnaud.quette.free.fr/">http://arnaud.quette.free.fr/</a><br><br><div class="gmail_quote">
2009/2/18 Volker Theile <span dir="ltr">&lt;<a href="mailto:votdev@gmx.de">votdev@gmx.de</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi again,<br>
<br>
forgot to mention that i did the tests the following way:<br>
<br>
freenas:~# setenv UPSNAME ups<br>
freenas:~# setenv NOTIFYTYPE ONLINE<br>
freenas:~# upssched<br>
Executing command: resume<br>
Segmentation fault (core dumped)<br>
<br>
freenas:~# truss upssched<br>
__sysctl(0xbfbfea24,0x2,0xbfbfea2c,0xbfbfea30,0x0,0x0) = 0 (0x0)<br>
mmap(0x0,280,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 671584256 (0x28079000)<br>
munmap(0x28079000,280) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
__sysctl(0xbfbfea88,0x2,0x28075d7c,0xbfbfea90,0x0,0x0) = 0 (0x0)<br>
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 671584256 (0x28079000)<br>
issetugid(0x2806eeac,0xbfbfeb50,0x104,0x0,0x0,0x0) = 0 (0x0)<br>
open(&quot;/etc/libmap.conf&quot;,O_RDONLY,0666) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ERR#2 &#39;No such file or directory&#39;<br>
open(&quot;/var/run/ld-elf.so.hints&quot;,O_RDONLY,00) &nbsp; &nbsp; = 3 (0x3)<br>
read(3,&quot;Ehnt\^A\0\0\0\M^@\0\0\0\^]\0\0\0&quot;...,128) = 128 (0x80)<br>
lseek(3,0x80,SEEK_SET) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 128 (0x80)<br>
read(3,&quot;/usr/lib:/usr/local/lib:/lib\0&quot;,29) &nbsp; &nbsp; &nbsp;= 29 (0x1d)<br>
close(3) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
access(&quot;/usr/lib/libc.so.7&quot;,0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ERR#2 &#39;No such file or directory&#39;<br>
access(&quot;/usr/local/lib/libc.so.7&quot;,0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ERR#2 &#39;No such file or directory&#39;<br>
access(&quot;/lib/libc.so.7&quot;,0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
open(&quot;/lib/libc.so.7&quot;,O_RDONLY,00) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 3 (0x3)<br>
fstat(3,{ mode=-rwxr-xr-x ,inode=8054,size=1057976,blksize=4096 }) = 0 (0x0)<br>
read(3,&quot;\^?ELF\^A\^A\^A\t\0\0\0\0\0\0\0&quot;...,4096) = 4096 (0x1000)<br>
mmap(0x0,1056768,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_NOCORE,3,0x0) = 671617024 (0x28081000)<br>
mprotect(0x28168000,4096,PROT_READ|PROT_WRITE|PROT_EXEC) = 0 (0x0)<br>
mprotect(0x28168000,4096,PROT_READ|PROT_EXEC) &nbsp; &nbsp;= 0 (0x0)<br>
mmap(0x28169000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0xe8000) = 672567296 (0x28169000)<br>
mmap(0x2816f000,81920,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 672591872 (0x2816f000)<br>
close(3) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
sysarch(0xa,0xbfbfeaf0,0x2804f16b,0x28074734,0x28060529,0x28074734) = 0 (0x0)<br>
mmap(0x0,608,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 672673792 (0x28183000)<br>
munmap(0x28183000,608) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
mmap(0x0,21112,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 672673792 (0x28183000)<br>
munmap(0x28183000,21112) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)<br>

sigprocmask(SIG_SETMASK,0x0,0x0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
__sysctl(0xbfbfeaa4,0x2,0x2816fae0,0xbfbfeaac,0x0,0x0) = 0 (0x0)<br>
sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)<br>

sigprocmask(SIG_SETMASK,0x0,0x0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
__sysctl(0xbfbfe678,0x2,0x281738c0,0xbfbfe684,0x0,0x0) = 0 (0x0)<br>
__sysctl(0xbfbfe188,0x2,0x2818005c,0xbfbfe190,0x0,0x0) = 0 (0x0)<br>
__sysctl(0xbfbfe1d8,0x2,0xbfbfe1e4,0xbfbfe1e8,0x0,0x0) = 0 (0x0)<br>
readlink(&quot;/etc/malloc.conf&quot;,0xbfbfe277,1024) &nbsp; &nbsp; ERR#2 &#39;No such file or directory&#39;<br>
issetugid(0x28160aa0,0xbfbfe277,0x400,0xbfbfe684,0x0,0x0) = 0 (0x0)<br>
break(0x8100000) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
__sysctl(0xbfbfe514,0x2,0xbfbfe51c,0xbfbfe520,0x0,0x0) = 0 (0x0)<br>
mmap(0x0,1048576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 672673792 (0x28183000)<br>
mmap(0x28283000,512000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 673722368 (0x28283000)<br>
munmap(0x28183000,512000) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0 (0x0)<br>
open(&quot;/var/etc/upssched.conf&quot;,O_RDONLY,0666) &nbsp; &nbsp; = 3 (0x3)<br>
fstat(3,{ mode=-rw------- ,inode=63,size=507,blksize=4096 }) = 0 (0x0)<br>
read(3,&quot;CMDSCRIPT /usr/local/bin/upssche&quot;...,4096) = 507 (0x1fb)<br>
socket(PF_LOCAL,SOCK_STREAM,0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 4 (0x4)<br>
connect(4,{ AF_UNIX &quot;/var/run/upssched.pipe&quot; },106) ERR#2 &#39;No such file or directory&#39;<br>
Executing command: resume<br>
write(2,&quot;Executing command: resume\n&quot;,26) &nbsp; &nbsp; &nbsp; &nbsp;= 26 (0x1a)<br>
gettimeofday({1234996218.667506 },0x0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0 (0x0)<br>
SIGNAL 11 (SIGSEGV)<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
i&#39;m the developer and project leader of FreeNAS which uses NUT UPS. During upgrading from 2.2.2 to 2.4 i realized that i get a core dump in upssched when an event occurs. During my research i found out that this happens when the line:<br>

<br>
AT ONBATT * START-TIMER shutdown 30<br>
<br>
is parsed. It crashed then in add_arg_word at the following line:<br>
<br>
ctx-&gt;arglist[argpos] = realloc(ctx-&gt;arglist[argpos], newlen);<br>
<br>
I looked at the code (and did a diff to the previous stable code) but did not find anything. I&#39;m at the end of my knowledge now, so i want to ask you if you did have any idea?<br>
<br>
Regards<br>
Volker Theile<br>
<br>
The output of some variables before the crash:<br>
<br>
argpos: 5<br>
ctx-&gt;numargs: 6<br>
ctx-&gt;maxargs: 5<br>
ctx-&gt;wordbuf: 30<br>
wbuflen: 2<br>
ctx-&gt;argsize[argpos]: 0<br>
ctx-&gt;arglist[argpos]: 0<br>
newlen: 3<br>
<br>
gdb backtrace:<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x280e84ad in realloc () from /lib/libc.so.7<br>
(gdb)<br>
(gdb)<br>
(gdb)<br>
(gdb)<br>
(gdb) bt<br>
#0 &nbsp;0x280e84ad in realloc () from /lib/libc.so.7<br>
#1 &nbsp;0x0804ba40 in add_arg_word (ctx=0xbfbfe8f4) at parseconf.c:152<br>
#2 &nbsp;0x0804bc18 in endofword (ctx=0xbfbfe8f4) at parseconf.c:212<br>
#3 &nbsp;0x0804bedb in collect (ctx=0xbfbfe8f4) at parseconf.c:317<br>
#4 &nbsp;0x0804c2e5 in parse_char (ctx=0xbfbfe8f4) at parseconf.c:449<br>
#5 &nbsp;0x0804c41d in pconf_file_next (ctx=0xbfbfe8f4) at parseconf.c:499<br>
#6 &nbsp;0x0804a9e0 in checkconf () at upssched.c:874<br>
#7 &nbsp;0x0804aaa9 in main () at upssched.c:924<br>
(gdb)<br>
<br>
upssched.conf:<br>
<br>
CMDSCRIPT /usr/local/bin/upssched-cmd<br>
PIPEFN /var/run/upssched.pipe<br>
LOCKFN /var/run/upssched.lock<br>
<br>
AT COMMOK * EXECUTE notify<br>
AT COMMBAD * EXECUTE notify<br>
AT REPLBATT * EXECUTE notify<br>
AT NOCOMM * EXECUTE notify<br>
AT FSD * EXECUTE forced-shutdown<br>
AT NOPARENT * EXECUTE notify<br>
AT SHUTDOWN * EXECUTE notify<br>
AT ONLINE * CANCEL-TIMER shutdown<br>
AT ONLINE * EXECUTE resume<br>
AT ONBATT * START-TIMER shutdown 30<br>
AT ONBATT * EXECUTE shutdown-warning<br>
AT LOWBATT * START-TIMER shutdown<br>
AT LOWBATT * EXECUTE shutdown-warning<br>
<br>
<br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br>