Download Manager semaphore issue

Asked by Max Jiang

Hello,

I am a little lost here.

By looking at XiboClient.py it seems to me when calling "collect" of "XiboDownloadManager" it does not release the lock unless there is no running downloads ( runningDownloads = 0). However, the lock remains there if there are (runningDownloads > 0) and the queue entry is task_done regardless. The download manager will then be locked forever. No more media/layout will be downloaded. However, if you set xmdsUpdateInterval large enough it would be fine but that is not ideal.

Have I missed anything here?

Cheers,
Max

Question information

Language:
English Edit question
Status:
Solved
For:
Xibo Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Harrington
Solved:
Last query:
Last reply:
Revision history for this message
Alex Harrington (alexharrington) said :
#1

runningDownloads is only ever > 0 if there are download threads running. So basically if there's a collection running in the background from the last time the download manager was woken, it skips this run.

The lock isn't cleared this time, but it will be next time the collection interval timer (xmdsUpdateInterval seconds later) is called assuming the running downloads have finished by then.

Alex

Revision history for this message
Best Alex Harrington (alexharrington) said :
#2

Actually maybe you're right.

Probably needs something like:
   self.p.enqueue('timer',(int(self.interval) * 1000,self.collect))

in http://bazaar.launchpad.net/~alexharrington/xibo/pyclient-1.3.2/view/head:/client/python/XiboClient.py#L1187

as an else.

Alex

Revision history for this message
Max Jiang (maxjiang) said :
#3

wow that's quick Alex.

But isn't the download manager stuck on self. __lock.aquire() and the collect function is not being called anywhere (since the queue entry for calling it is task_doned already? Therefore the download manager thread hangs indefinitely? Sorry if I am being dumb here.

Revision history for this message
Max Jiang (maxjiang) said :
#4

Good stuff. Thanks, Alex.

Revision history for this message
Max Jiang (maxjiang) said :
#5

Thanks Alex Harrington, that solved my question.