[Nut-upsdev] upsd segfault.

Charles Lepple clepple at gmail.com
Mon Dec 22 01:24:56 UTC 2008


On Dec 21, 2008, at 7:28 PM, Kjell Claesson wrote:

> Den Sunday 21 December 2008 22.57.14 skrev Arjen de Korte:
>> Citeren Charles Lepple <clepple at gmail.com>:
> Hi Arjen,
>>>> This is strange. I have no debugging info but i built it with - 
>>>> g , but
>>>> it would
>>>> not give me anything but ??:0 as output. So i built it with - 
>>>> gstabs, and
>>>> guess what.... it does not segfault.
>>>
> I was to fast about this. Made some more tests and guess what.
>
> If I start the upsd when the ups is on, I can set it in standby and  
> start
> it up without segfault. Tested this several times and no segfault.
>
> But if I start the upsd when it is in standby, then it segfault  
> when i go to
> online. Don't care if I compiled with -gstabs. And it does it every  
> time.
>
> The only thing I can think of is that it is sending a alarm when i  
> start
> the upsd in standby.
> -----------------
> ups.alarm: LOAD_DUMPED
> ups.firmware: Cont:02.03 Inve:02.03
> ups.load:   0.0
> ups.model: PW5125     1000VA
> ups.power.nominal: 1000
> ups.serial: GB282A0427
> ups.status: ALARM OFF
> -----------------
> When online it dont set the alram line
> -----------
> output.voltage.nominal: 230
> ups.firmware: Cont:02.03 Inve:02.03
> ups.load:   0.0
> ups.model: PW5125     1000VA
> ups.power.nominal: 1000
> ups.serial: GB282A0427
> ups.status: OL
> ----------------------
>
>>> Well, it sort of sounds like it might be related to the compiler -
>>> using a different debugging option shouldn't change how the code is
>>> generated, unless it isn't optimizing as much with -gstabs.
>>
> This falls as stated above.
>
>> Another thing to try is to run it through valgrind. This works  
>> best if
>> you switch of optimization ('-O0', which should be read as -O<zero>),
>> but usually will also give usable info with optimized code ('-O2' or
>> even 'O3') as well.
>
> Can't get the debug symbols in. Looks like it don't care about the - 
> g or
> -gstabs on the flag line. I can see that it use it during compile. But
> when I test for symbols (nm or valgrind) it say no symbols.
> Think I have to build some more with debug flag.

Is it possible that the ebuild is stripping the symbols from the  
binaries (either with the "strip" command, or implicitly through  
"install -s")?

> Then I can not get it to run with valgrind. It exits. Any howto on  
> this
> would be nice.

When I ran valgrind on the tripplite_usb driver (way back when), I  
just put valgrind at the beginning of the command line, then ran it,  
and incrementally added options until it was ignoring everything that  
was not an error. I am not sure if there is something else to add  
that would let it handle forking, but I think you could also run upsd  
with the debug flag(s) to keep it in the foreground.

> Switched over to my PW5115 and it is the same. If it is in standby  
> when
> I start upsd, it segfault when i go to online. But if I start upsd  
> when it is
> online. I can switch it off and on whitout segfault.
>
> So normaly you don't notice this as it have to be online if it  
> supports the
> computer running NUT. But if you have one more ups that is in standby
> and is connected to the NUT server and you put it online after the  
> server is
> started it would segfault the upsd.


It sounds like it has something to do with how the alarms are  
handled. I am not at all familiar with that code, however.

-- 
Charles Lepple
clepple at gmail






More information about the Nut-upsdev mailing list