Terminate a hanging Docker Container automatically

Let’s say you have a docker container that you run periodically, and it runs fine most of the time, but in some rare cases, it hangs. This can be very annoying, and it might take some time to find the root cause of the problem.

In the meantime, it would be great if the container would be terminated automatically after exceeding a user-defined maximum runtime.

To solve this problem, you can use the following Python script (don’t forget to change image_name and max_minutes to your environment):

Continue reading “Terminate a hanging Docker Container automatically”

What is Name Mangling in C++?

When we write programs in C++, we create new functions and methods with (hopefully) descriptive names all the time. Names are important for us humans to understand code. But in the compiled machine code of our finished executables, they don’t play any role. The CPU doesn’t even know about them.

Whenever our program has loaded, all functions and methods are placed at specific memory addresses of the virtual address space assigned to the process of our running program. Whenever a function calls another function, it doesn’t call the name of the function but the address where the function is located in memory.

Continue reading “What is Name Mangling in C++?”