Let's play with Go applications: the goal of this hands-on is to learn how to diagnose a misbehaving Go application, with different kind of tools, from generic unix tools, to very specific go tools.
The first part of the hands-on is an explanation of the tools we'll be using:
- some standard unix tools
- sending signals to a running application
- generating and inspecting core dumps
- go HTTP handlers (collecting profiles/traces)
- analyzing pprof profiles
- analyzing execution traces
Then, once you feel comfortable with these tools, you can build or download the sample application that we'll be using to practice:
- build it simply by running
go build
(with go >= 1.10) - it will produce a binary namedhands-on-diagnosing-golang-apps
- download a binary from the latest release
Start it (just execute the binary), and hit the endpoint at :6060
by default.
At this point, the application should have a correct behaviour. The default endpoint should display a hello world
message correctly. This would be a good time to play with some of the tools we learned about, to see what exactly it means for our application to have a "correct" behaviour.
When you're ready, you can start the exercice:
- Start by the step 1, by hitting the /goto?step=1 endpoint, that will activate the first "bad" behaviour. Now, you'll need to use the tools we just explored, to identify what is missbehaving in the application. Go, do it. And then come back here. Once it's done (or if you failed to identify the issue), you can read the solution.
- Then, switch to the step 2, by hitting the /goto?step=2 endpoint, that will activate the second "bad" behaviour. Once you've done, you can read the solution.
- Then, switch to the step 3, by hitting the /goto?step=3 endpoint, that will activate the third "bad" behaviour. Once you've done, you can read the solution.
- Then, switch to the step 4, by hitting the /goto?step=4 endpoint, that will activate the fourth "bad" behaviour. Once you've done, you can read the solution.
- Then, switch to the step 5, by hitting the /goto?step=5 endpoint, that will activate the fifth "bad" behaviour. Once you've done, you can read the solution.
- Then, switch to the step 6, by hitting the /goto?step=6 endpoint, that will activate the sixth "bad" behaviour. Once you've done, you can read the solution.