Hi Stefano,

I ran test.py and it completed without error.  I then ran it again and it failed at B9, I ran it several times more and it failed at B9 each time.

I then made the change you suggested and ran it again, it still failed at B9.  I then rebooted and ran it again and it completed without error.  I then ran it many more times and it still completed without error.  So it would appear that your fix together with a reboot fixes the problem :)

Is this something which should be fixed in owserver or should it be a discipline on the user to add b'\x00' to any string when writing?

Mick


On 13/10/2019 21:25, Stefano Miccoli via Owfs-developers wrote:
I had no time to stress test my installation, but let me add some thoughts here.

The fact that failures are sporadic, and that a reboot makes the system more resilient, makes me guess that there is a memory leak in owserver.

I suspect that this could be linked to the way in which strings are treated in owserver. I clearly remember that when I implemented the write feature I asked on this list if data sent in a write request should be null-terminated. Paul replied that this was not necessary, since the length of the payload is known to owserver.

Therefore the payload for an alias is sent by pyownet as something like

b”/26.123412341234/alias\x00T0”

(where b”\x00” is a null byte in python). This means that on the receiving side the C code has to add a null terminator to the received alias. So I would suggest to test writes likes this

owp.write(addr,  newa + b'\x00')

just to see explicitly adding a null terminator on the sending side mitigates the problem. (Please note that this is just a wild guess, maybe the problem is in another portion of the code.)

Stefano

_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to