cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

'Thing not Running' Issue

amittal-3
14-Alexandrite

'Thing not Running' Issue

Hello,

I am facing an issue when I am creating thing programatically. I know there are couple of good discussions already available on the portal. I think am following the necessary steps while creating things which are suggested, of Enabling and Restarting the thing.

This is not a very frequent error, and most of the time I don't get the 'Thing not running' exception, so I believe procedure is correct for most of the time, but the problem is, I am not able to identify the solution when this error comes.

I even tried to again restart and enable the thing when 'Thing not running' error comes, but still of no use. What is more weird is, when the thing is not running if I call the service 'IsEnabled' it returns true, and rest all other service gives exception, for example 'Get Description'.

Some posts are also taking about 'ghost entities' and are suggesting to restart the Tomcat, but in this particular case even that's not working for me.

I am using VirtualBox docker version of Thingworx

Some posts and topics that I referred are - 

https://community.ptc.com/t5/ThingWorx-Developers/JavaScript-CreateThing-Thing-is-not-running/td-p/508232

https://community.ptc.com/t5/ThingWorx-Developers/Thing-ThingName-is-not-running/td-p/531655

https://community.ptc.com/t5/ThingWorx-Developers/Things-are-in-quot-Thing-is-not-Running-quot-state/td-p/503273

https://community.ptc.com/t5/ThingWorx-Developers/Creating-Things-but-not-running/m-p/507967#M5735

Any help would be appreciated.

Thanks in advance

Regards

Aditya Mittal

5 REPLIES 5

Did you find any solution to it, because we are facing exactly the same problem? Thanks in advance.

This problem can be cause by a lot of different things, if you can concrete a bit more your problem we may help.

amittal-3
14-Alexandrite
(To:cchhetri)

Hello,

I am still facing this issue and I have not been to completely figure out the cause of the issue, but I have tried to minimise it, so that it doesn't block me.

Most of the time I have observed it occurring when we try to programatically add properties or subscriptions to a Thing. Other times I have seen it commonly for Remote Thing (creating it dynamically), when the Industrial Gateway which is to be assigned to Remote Thing's 'IndustrialThing' property is already connected.

So if you are doing something similar of that sort, I would suggest that if possible you can break the steps, like let the Thing be created...give some delay, then add properties..then give some delay and then add subscriptions.

I am sure this is not the right way to solve the issue, but this way I have minimised it.

As Carles has already mentioned that it can be caused due to multiple reasons, we have figure out what could be its cause in each of our specific cases.

If possible, at high level if you can give us the steps when is this occurring maybe we both can be benefited after discussing it.

Regards

Aditya Mittal

Alessio
15-Moonstone
(To:amittal-3)

Hi Aditya,

 

according to CS255702, after a thing has being modified (either programmatically or within the Composer), or the template it is based on has been modified, the thing itself is restarted. 

If you try to modify the thing (by adding a dynamic subscription, a property, etc.) while it is restarting you will get this error. Actually you cannot do anything on the thing while it is restarting, not even calling a service or setting a property value.

 

You should enclose the interaction with the thing within a try/catch block, and possibly repeat the operation after a short timeout: you should probably encapsulate this logic in a service (not defined in the thing itself of course :-)  / do it on an quasi-immutable thing instead) which performs the exception handling and retry operations.

 

HTH,

Alessio

 

 

amittal-3
14-Alexandrite
(To:Alessio)

Hello Alessio,

Thanks for your reply. Actually I was not aware (or even sure) of when you said 


@Alessio wrote:

according to CS255702, after a thing has being modified (either programmatically or within the Composer), or the template it is based on has been modified, the thing itself is restarted. 

I don't think, that after adding properties programatically the thing is automatically re-started. Actually, I got to know that after adding properties, we have to explicitly make a call to restart thing. I am saying all this in context of modifying thing programatically and not through composer.

Refer, 

https://community.ptc.com/t5/ThingWorx-Developers/Unable-to-add-new-property-programatically-using-service/m-p/553691#M29093

So when adding properties I am making sure that I do not perform any other transaction before and until the thing is explicitly restarted.

For adding dynamic subscriptions its just other way round, dynamic subscriptions are lost when the thing is restarted, so we have to again add dynamic subscription, everytime the thing is restarted.

So u can confirm if my understanding is right in this case or not.

I would again go through the article  CS255702, to see if I can get some more pointer to resolve this issue. Thanks for sharing the reference.

-Aditya

Announcements


Top Tags