Hello,
I see some strange behaviour when writing an attribute on a tango group, unless I have misunderstood how it should work. The real situation is that I have a group of approx 200 power supplies, and I want to write to the Current attribute at 10Hz. The group reply is generally fast enough but sometimes it takes longer than 0.1s, and in this case I thought I could use the timeout in the write_attribute_reply to just ignore this, as I don’t care about the reply. Over time however the memory increases towards 100pc. (Group — PyTango 9.3.0 documentation)
I can illustrate with a dummy device that provides a Current attribute, that I have hard coded to take 0.1s to write. With the client below I make a group of 10, then try relatively quickly - the sleep in the loop is only 0.001s. This is more extreme than the real case where the loop time there is actually comparable to the write time.
If I have no timeout the write time is always around 0.1s as expected. If I set the timeout to 0.001, the write time becomes something like 0.00035, which is strange as I would expect 0.001. Also the memory use shoots up. More oddly, if I change the timeout to 0.002 or above, the write time becomes around 0.12. So even slower than if I had no timeout, though without a memory leak.
I can imagine if you keep the replies and write faster than you consume them, you will build up a buffer of replies in memory. But I would have thought that the point of the timeout is to throw these away.
Many thanks for any advice (pytango 9.2.1 and 9.3.0)
Paul
Client code:
import PyTango
import time
test_group = PyTango.Group(“test”)
test_group.add(“simulation/dummyps/1”)
#repeat for dummy power supplies 2 to 10
vals = [1,2,3,4,5,6,7,8,9,10]
while True:
time.sleep(0.001)
now = time.time()
id = test_group.write_attribute_asynch(“Current”,vals,multi=True)
reply = test_group.write_attribute_reply(id, 10) # 10ms = 0.001s to wait
print "wrote in ", time.time()-now