Two script instances?

Having problems? Maybe others have had the same problem too. Post HouseBot technical issues here.
Post Reply
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Two script instances?

Post by Osler »

Scott:

I don't know that I can prove this, but I think I have two instances of the same device script running within HB at the same time. I encountered this when I did a restart of HB and the script would be automatically set to running. If I look at my log, I see the "calling script to run" but none of the trace messages I put into the script on start-up. Initially I had thought there was a problem, but if I waited long enough my trace messages would appear. Regardless, before I realized this I would stop the script immediately after an HB restart and then set it to running again. At times I would get an error saying the script is already running....but not always. Once this was done, every property set from the script would occur twice. For example, adding a song to the queue of my ZonePlayer would result in the song being added to the queue twice. I have been pouring over my own code for most of today trying to find my error, but I don't see one. Adding a song to the queue only involves a theme with a property change button that uses property value substitution. My code takes that property, sets it to a null string, and then uses it to add the song to the queue. There is no way that this could be occuring twice via my code. (I reinstalled 3.30.2 today thinking something was afoul with the current installation). Though I don't see dual trace messages at script start-up when this occurs, property change message logging from within HB does show a dual occurence of a property value change. Any ideas?

Osler
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Re: Two script instances?

Post by Richard Naninck »

I can't find the thread anymore or maybe I emailed Scott about this some time ago, but this seems to be a Windows error where the thread just doesn't get killed. The script state tells you it stopped, but the script is still running. I have seen this many many times and I it bugged me from time to time but now I am aware that this can happen. One time I was changing script lines and nomatter what code changes I made, my old msgbox statements kept on going. It drove me crazy. Restarting the HB server seems to be the only solution in that case. To prevent this, you must not stop a script using the script state, but have the script stop itself upon receiving somekind of own built stop command. When a script interacts with other objects, windows doesn't kill the script for some reason.
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Re: Two script instances?

Post by Osler »

Thanks Richard. That is good to know. At least I am not as crazy as I thought I was.

Osler
Post Reply