This post is about a program hang. The hang was in the Python process that was running Ansible scripts. The problem was hard to debug and had me go back to Unix textbook.
[Read More]Correct way to create a directory in Python
Can you see the problem with this code? It comes from Ansible, v2.1.1.0.
if not os.path.exists(value):
os.makedirs(value, 0o700)
It’s quite straightforward. It checks if a directory path exists. If
it does not, then it creates the directory path, similar to mkdir -p
. What could be wrong?
Getting rid of unused virtual disks on XenServer
A continuous test server I’d set up had stopped working. The XenServer on which it was running had a 1TB disk: and it was full. What’s going on?
[Read More]Log rotation, no code change needed
This post shows you how to rotate old logs from your application. There is no change to application code. There is no specialized logging library or framework needed. It works for any language, on standard Unix platform.
[Read More]Resetting a TCP connection and SO_LINGER
Can you quickly close a TCP connection in your program by sending a reset (“RST”) packet?
[Read More]Program crashes, only in 64-bit mode
This is a story of a program that worked, until it broke on a 64-bit platform.
[Read More]ps | grep is broken on FreeBSD
It is true. Even on the latest FreeBSD 11.0 (I checked the source tree).
[Read More]Debugging emacs slowness
I use Emacs (emerge) while merging files. Today, when trying to merge some Python code, I found that it was taking exceedingly long time. It was blank for 5 minutes and counting.
[Read More]Weird PID files
This is a story of multiple processes running on a system, but with empty PID files.
It took a lot of debugging.
[Read More]Don't hang up on me
Can you tell me when a shell sends a “HANGUP” signal to a process? What happens if there is a pipeline? What if you prefix this pipeline with the “nohup” command?
[Read More]