Re: [Nut-upsuser] upsd crashes with a broken pipe error

2011-02-16 Thread Zach La Celle

On 02/15/2011 03:48 PM, Zach La Celle wrote:

On 02/15/2011 03:27 PM, Arjen de Korte wrote:

Citeren Zach La Celle lace...@roboticresearch.com:

You can see where the problem happens in parseconf.c, on line 125 
with the code:

/* resize the lists */
ctx-arglist = realloc(ctx-arglist,
   sizeof(char *) * ctx-numargs);


With the given arguments, this boils down to

ctx-arglist = realloc(NULL, sizeof(char *));

This is all normal. Upon the first invocation of add_arg_word, 
ctx-arglist will be a NULL pointer (since there is nothing in the 
list yet). This should then allocate a one element array of a pointer 
to char (to store the


If ptr is a null pointer, realloc() shall be equivalent to malloc() 
for the specified size.


After that, all hell breaks loose, but that's out of our control.

There is a slight problem in lines 131-132

ctx-argsize = realloc(ctx-argsize, sizeof(int *) * ctx-numargs);

which should really read

ctx-argsize = realloc(ctx-argsize, sizeof(size_t) * ctx-numargs);

but I doubt that sizeof(size_t) will be smaller that sizeof(int *), 
so this just wastes a few bytes of memory.



This also might help:
(gdb) p *ctx
$4 = {f = 0x0, state = 5, ch = 9, arglist = 0x0, argsize = 0x0, 
numargs = 1, maxargs = 1, wordbuf = 0x61f2e0 Z, wordptr = 0x61f2fd 
, wordbufsize = 16, linenum = 0, error = 0, errmsg = '\000' 
repeats 255 times, errhandler = 0, magic = 7497264, arg_limit = 
32, wordlen_limit = 512}


None of these values is suspect.

If I go up in GDB to the pconf_char function, here is the 
character which is killing it:

(gdb) p ch
$6 = 9 '\t'


This is expected. Any whitespace character ends the collection of 
characters for the current argument and will start a new one. Nothing 
out of the ordinary. If it was, 100% of the NUT installations would 
suffer the same problems as you're seeing 100% of the time they start 
the upsd server. This is not the case and even in your case, the 
problem seems to occur intermittently, which is more an indication 
you're either running out of memory or the system is suffering from 
bad memory. Did you run a memory check lately?


Best regards, Arjen
I will run memtest86 tonight when I can garner some time to bring the 
server down.  It has 4GB of memory and is currently utilizing only 
500MB, so I doubt it runs out.  Nothing else is crashing.  It only 
runs email and apache.


Thank you for your help,

-Zach

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser
On the Dell server, the MpMemory testing all passed.  It doesn't seem to 
be a physical problem with the memory on the machine.  I also ran some 
other basic diagnostics on the disk drives, cache, and the rest of the 
system, and it all passed as well.


Any further ideas?

Thanks,

-Zach

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] upsd crashes with a broken pipe error

2011-02-16 Thread Arjen de Korte

Citeren Zach La Celle lace...@roboticresearch.com:

On the Dell server, the MpMemory testing all passed.  It doesn't  
seem to be a physical problem with the memory on the machine.  I  
also ran some other basic diagnostics on the disk drives, cache, and  
the rest of the system, and it all passed as well.


Any further ideas?


As a last resort, running the upsd server in 'valgrind' could be  
useful, but only if the error occurs shortly after startup. You'll  
have to run it with -D though, to prevent it from backgrounding.


What remains weird is that you seem to be the only one that has this  
problem. I've run upsd in valgrind for days on end and have not seen  
any memory problems after that.


Best regards, Arjen
--
Please keep list traffic on the list (off-list replies will be rejected)


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] upsd crashes with a broken pipe error

2011-02-16 Thread Zach La Celle

On 02/16/2011 10:16 AM, Arjen de Korte wrote:

Citeren Zach La Celle lace...@roboticresearch.com:

On the Dell server, the MpMemory testing all passed.  It doesn't seem 
to be a physical problem with the memory on the machine.  I also ran 
some other basic diagnostics on the disk drives, cache, and the rest 
of the system, and it all passed as well.


Any further ideas?


As a last resort, running the upsd server in 'valgrind' could be 
useful, but only if the error occurs shortly after startup. You'll 
have to run it with -D though, to prevent it from backgrounding.


What remains weird is that you seem to be the only one that has this 
problem. I've run upsd in valgrind for days on end and have not seen 
any memory problems after that.


Best regards, Arjen
Unfortunately, errors usually take days to occur.  They also don't occur 
on a regular interval.  I'm wondering if the serial port to the APC is 
giving weird values...although I'm not sure why that would cause a 
malloc error.


-Zach

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


[Nut-upsuser] Ippon Smart Winner 750/1000/1500/2000/3000

2011-02-16 Thread Александр

Have anybody expirience with

Ippon Smart Winner 750/1000/1500/2000/3000

with serial interface ?

I have tryed megatec and blazer_ser drivers with no success:


[IPPON]
   driver = megatec
   port = /dev/ttyd0
   desc = IPPON smart winner 1500VA
   model = Smart Winner 750/1000/1500/2000/3000


# ./megatec -a IPPON -DDD
Network UPS Tools - Megatec protocol driver 1.6 (2.4.1)
debug level is '3'
DTR=1, RTS=0
Starting UPS detection process...
Asking for UPS information [I]...
I = FAILED [timeout]
Asking for UPS status [Q1]...
Q1 = FAILED [timeout]
Asking for UPS status [Q1]...
Q1 = FAILED [timeout]
Asking for UPS status [Q1]...
Q1 = FAILED [timeout]
Asking for UPS status [Q1]...
Q1 = FAILED [timeout]
Asking for UPS status [Q1]...
Q1 = FAILED [timeout]
5 out of 5 detection attempts failed (minimum failures: 2).
Megatec protocol UPS not detected.

FreeBSD irkutsk-gate 7.2-RELEASE-p8 FreeBSD 7.2-RELEASE-p8 #0: Tue May 25 
17:51:43 UTC 2010 
r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

I have tryed to use both /dev/ttyd0 and /dev/cuad0 devices.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser