On programming and stuff

Use strace. Duh!

| Comments

Really short entry, but I hope someone will benefit from it :)

The background

Strace is a linux tool that is able to attach to any process and monitor system calls being made by it.

It's simple & complex at the same time and requires a little reading on the topic, but it's totally worth it.

The scenario

Recently I had strange problems with postgresql (well not with postgresql itself but a certain postgresql configuration on a certain machine :)) which were pretty hard to debug using "standard" ways - monitoring software, logs, etc. Luckily I remembered about a small tool called strace, which to be honest I haven't used for like 2 or 3 years. With that utility, it was pretty easy to find & fix connection problems.

The point of this article: strace follows unix philosophy of doing one small thing pretty well, but in the world of many tools & open source software it's rather forgotton (at least to me it was), and it's a shame because it can be really helpful. Try to play with it and maybe one day you'll find it handy like I did :)

After all the problems I came across an article, which gives a more thorough explanation on this topic: Debugging obscure postgres problems


comments powered by Disqus