Dash creating multiple objects, not closing processes


#1

I think I gotta do some explaining on this one, because the title isn’t entirely accurate.

The app/GUI I’m creating connects to a Hardware Interface, using a LAN connection. Now, the main script initiates a Device-object which basically handles all the functions of the Hardware, while the main Controller-object serves as an Interface between the Device and a UI object, which contains a Dash app.

When running, apparently the Dash app creates multiple Device objects or somehow opens multiple TCP connections (which should only happen when a new Device-object is initiated), resulting in a crash as the interface processor can only handle 1024 open processes at a time.

It seems to me that this is due to the callback mechanic. One part of the app is an Interval component and as such the app runs stable for a time until enough callbacks have been executed, at which point the device gets an error and can’t come back.

Am I just missing something and this is kind of innate to the way Dash works and sets up the callbacks? I’m not even sure how to formulate the question…


#2

I’m really confused about this. Does it have to do with how callbacks work? They seem to start new connections or create new objects each time they execute, without properly destroying them afterwards, even though all actions should be performed on the same, existing object.

Do I have to enable some kind of threading option? Or is it an issue with the flask server? Or should none of that happen and it’s a plain issue with my code? Maybe youre got a vague idea, @chriddyp? Just need a push in the right direction (hopefully. :slight_smile:


#3

Fixed it: Set threaded=False in app.run_server() and also processes=1.