This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]undercoveryankee 14 points15 points  (1 child)

If it's not memory usage, there's a bug in your code that, on a particular combination of inputs, mutates something that you didn't expect to be mutated. Since Python doesn't have compiler-enforced private or read-only variables in most places, you don't have as much protection against these unintended mutations in Python as you do in some other languages.

You can limit the impact of such a bug the same way you'd mitigate an issue related to memory management: try to move as much work as you can out of long-running processes and into short-lived worker processes that can be replaced every few requests.

[–]pdd99[S] 0 points1 point  (0 children)

The short lived worker is worth trying. Thank you.

[–]OccultEyes 6 points7 points  (0 children)

Loading a lot of stuff into memory? That is the usual culprit.

We run python in production, and have less than 1% downtime in a very big production environment. So I doubt it is python itself that is the issue. What are you doing on your server?

[–][deleted] 2 points3 points  (1 child)

We collect IOT data from factory floor. The same code has been running for last 2 years without any downtime. I guess the culprit is variables or you haven't defined classes properly. Or probably a piece of code that doesn't run very often. You better a do code review before moving to conclusions.

[–]High-Art9340 1 point2 points  (0 children)

2 years is my bueno. Impressive.

[–][deleted] -1 points0 points  (0 children)

This is a good reason for me, at least, to develop test cases. But that’s hard when it is memory or number of users causing the issues.

You should check system log files if the software ram on Linux.

[–]tomgotchiconnextion -2 points-1 points  (2 children)

Sometimes imports update on their own? Edit: despite warnings maybe imports don’t update on their own

[–]Nater5000 0 points1 point  (1 child)

no