Web stack debugging
Hassan Juma
Solution Architect | DevOps Engineer | CKA | CKAD | Kubernetes | SRE | Platform Engineering
Intro
Debugging usually takes a big chunk of a software engineer’s time. The art of debugging is tough and it takes years, even decades to master, and that is why seasoned software engineers are the best at it… experience. They have seen lots of broken code, buggy systems, weird edge cases, and race conditions.
Non-exhaustive guide to debugging
School specific
If you are struggling to get something right that is run on the checker, like a Bash script or a piece of code, keep in mind that you can simulate the flow by starting a Docker container with the distribution that is specified in the requirements and by running your code. Check the?Docker?concept page for more info.
Test and verify your assumptions
The idea is to ask a set of questions until you find the issue. For example, if you installed a web server and it isn’t serving a page when browsing the IP, here are some questions you can ask yourself to start debugging:
There is a good chance that at this point you will already have found part of the issue.
Get a quick overview of the machine state
When you connect to a server/machine/computer/container you want to understand what’s happened recently and what’s happening now, and you can do this with?5 commands?in a minute or less:
w
history
领英推荐
top
df
netstat
Machine
Debugging is pretty much about verifying assumptions, in a perfect world the software or system we are working on would be working perfectly, the server is in perfect shape and everybody is happy. But actually, it NEVER goes this way, things ALWAYS fail (it’s tremendous!).
For the machine level, you want to ask yourself these questions:
If the answer is?no?for any of these questions, then that might be the reason why things are not going as expected. There are often 3 ways of solving the issue:
Network issue
For the machine level, you want to ask yourself these questions:
Process issue
If a piece of Software isn’t behaving as expected, it can obviously be because of above reasons… but the good news is that there is more to look into (there is ALWAYS more to look into actually).
Debugging is fun
Debugging can be frustrating, but it will definitely be part of your job, it requires experience and methodology to become good at it. The good news is that bugs are never going away, and the more experienced you become, trickier bugs will be assigned to you! Good luck :)