dtng25909 2019-04-18 06:55
浏览 229

Golang应用程序被卡住,但尝试终止时却因某种原因被卡住

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 基于单片机数字电压表电路组成及框图
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line