I have written a golang web application using standard go libraries. I have an API that starts a goroutine.
In the goroutine I loop through a finite list of data, around 5000 units, and process each entry. As each entry is processed I print to terminal using fmt.Println()
and sleep using time.Sleep(500 * time.Millisecond)
. Each processing takes roughly 500ms.
I start my go program using Ubuntu in Windows (Windows Subsystem for Linux), with command like go build && ./app
.
When I kick off the goroutine through API call, I can see prints in the terminal. After a while I notice the print messages stopping and nothing being processed. I check the DB using SELECT COUNT(*)...
, as I log one DB entry per processing and see the count does not change. When I go to terminate the program by pressing <kbd>CTRL-C</kbd> in the terminal, the program doesn't terminate. Instead somehow the processing resumes and I start to see prints in the terminal again.
Does anyone know why this might be happening? Or how I can start to debug this issue? Thanks in advance.