On Mon, 2015-08-31 at 23:51 +0200, - wrote:
> Package: qcontrol
> Version: 0.5.4-1+deb8u1
> Severity: normal
> 
> I noticed on my QNAP TS-219P that during the last boot, I've been getting
> log lines like these every five seconds, from bootup at aug 7 to just now.
> 
> Aug  7 10:34:30 host systemd[1]: Starting LSB: Start qcontrol daemon...
> Aug  7 10:34:30 host qcontrol[332]: qcontrol 0.5.4 daemon starting.
> Aug  7 10:34:30 host qcontrol[332]: confdir: loading from /etc/qcontrol.d...
> Aug  7 10:34:30 host qcontrol[332]: System status: start
> Aug  7 10:34:31 host qcontrol[332]: Unknown system status
> Aug  7 10:34:31 host qcontrol[332]: ts219: temperature 32
> Aug  7 10:34:31 host systemd[1]: Started LSB: Start qcontrol daemon.
> Aug  7 10:34:32 host qcontrold[300]: Starting qcontrol daemon: qcontrol.
> Aug  7 10:34:32 host qcontrol[332]: Error calling lua function temp: 
> /etc/qcontrol.conf:73: attempt to perform arithmetic on global 
> 'last_temp_value' (a string value)

Interesting.

lua will convert number strings to numbers as needed:
    > print(math.abs("1" - 2))
    1
so last_temp_value must contains a non-numeric string of some sort in
order to produce this message:
    > print(math.abs("a" - 2))
    stdin:1: attempt to perform arithmetic on a string value
    stack traceback:
            stdin:1: in main chunk
            [C]: in ?

last_temp_value is certainly initialised to 0 (not "0", just 0). It is
updated by:
        if ( should_log() ) then
                logprint(string.format("ts219: temperature %d", temp))
                last_temp_log = now
                last_temp_value = temp
        end

where should_log() is the thing attempting to perform arithmetic on the
global (i.e. where the warning comes from) and "temp" is the argument
to the event hook where all this is.

If we look at the logs we can see "ts219: temperature 32" which would
appear to be the first pass through this code, which should end up
setting last_temp_value to 32 (which was the argument).

However temp there is treated as a number several times (in the string
format quoted above, but also in should_log() in the same expression as
last_temp_value. So if it were anything other than a number I would
expect a similar warning to above but with "temp" instead of
"last_temp_value".

> Not sure what this is about, just wanted to give a heads-up in case there is 
> something in the qcontrol.conf (a symlink to qcontrol/ts219.lua) that needs
> to be fixed.

I'm stumped. I take it qcontrol.conf (=> qcontrol/ts219.lua) is
completely unmodified from the version shipped by the package? What is
the output of
    md5sum /etc/qcontrol.conf
? Or, perhaps better, please attach your version.

If you can reproduce this then perhaps you could instrument the
logtemp() function to unconditionally log the temp and last_temp_value
so we can see what it is? (This will be quite verbose, but no worse
than the error messages you are getting now...)

Ian.

Reply via email to