How do I find what is using memory in a Python process in a production system?

Using Python’s gc garbage collector interface and sys.getsizeof() it’s possible to dump all the python objects and their sizes. Here’s the code I’m using in production to troubleshoot a memory leak: rss = psutil.Process(os.getpid()).get_memory_info().rss # Dump variables if using more than 100MB of memory if rss > 100 * 1024 * 1024: memory_dump() os.abort() def … Read more

Core dump file is not generated

This link contains a good checklist why core dumps are not generated: The core would have been larger than the current limit. You don’t have the necessary permissions to dump core (directory and file). Notice that core dumps are placed in the dumping process’ current directory which could be different from the parent process. Verify … Read more

Core dump file analysis [duplicate]

You just need a binary (with debugging symbols included) that is identical to the one that generated the core dump file. Then you can run gdb path/to/the/binary path/to/the/core/dump/file to debug it. When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash. In the backtrace, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)