VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
460 stars 218 forks source link

Periodic methods calls cease if the method raises an unhandled exception. #167

Closed kmonson closed 9 years ago

hashstat commented 9 years ago

I don't think this should be considered a bug. The unhandled exception is likely to occur again in a subsequent run of the periodic. If that is the desired behavior, the agent developer should catch and log the exception.

I would actually recommend that unhandled exceptions in periodics be logged and then cause the agent to halt. But again, this should probably be explicitly handled by the agent developer. We want to be careful not to introduce too many automatic helps that may mask true errors or make them difficult to respond to.

Thoughts?

kmonson commented 9 years ago

I was bit by this when the driver's periodic scrape was failing and raising an exception that I did not catch. The current behavior kept the driver from recovering when communication with the device was restored. I've now handled it, but it was surprising way for the framework to act.

For me, the expected behavior is for the periodic to continue to be called even if it fails. This is the behavior of frameworks like twistd and tornado.

On Mon, Aug 31, 2015 at 9:41 AM, hashstat notifications@github.com wrote:

I don't think this should be considered a bug. The unhandled exception is likely to occur again in a subsequent run of the periodic. If that is the desired behavior, the agent developer should catch and log the exception.

I would actually recommend that unhandled exceptions in periodics be logged and then cause the agent to halt. But again, this should probably be explicitly handled by the agent developer. We want to be careful not to introduce too many automatic helps that may mask true errors or make them difficult to respond to.

Thoughts?

— Reply to this email directly or view it on GitHub https://github.com/VOLTTRON/volttron/issues/167#issuecomment-136424367.

hashstat commented 9 years ago

After discussing the issue with the team, we agreed that wrapping the periodic call in a try-except block and logging the exceptions is probably the best approach.