Go API server stops listening after some hours of running

Hello guys,

I have a Golang Api server serving for my android app. Its running in our AWS space.
I start the app and the server runs for at max 5 to 6 hours and stops automatically.

Sometimes I get this statement in terminal
Connection reset by 13.***.***.11 port 22.

Sometimes nothing shows up in terminal.

It’s been weeks and I have completed the api but couldn’t deploy due to this problem.

Please provide me solutions.

You get that in terminal?

How are you running that server?

It sounds as if you were sshing into the server and start your app in that ssh-session. If you really do this, then your application is started as child to the shell you start as part of your ssh session, and as soon as the session dies, it children die as well.

Use proper systemd-units or otherwise service descriptions for your system that handle start/stop of your application.

1 Like

Thanks for the help man…I understand now I should run the app in background using a service.
I am new to this server side executions. I have experience in node and I use a framework to run the application. Is there any similar framework for Go?
If not should I use docker?

Since you didn’t tell which framework you used in node, we can’t tell you if there is a similar available in go. But I can tell that there are frameworks for creating web applications or JSON APIs.

You need to google for yourself.

But even if you use a framework, you still need to properly deploy your application.

Shouldn’t have been different with node. There you need a service running as well…

1 Like

This message come from your program, standard library or a panic? Also log your actions in your program to find more details about the point where it hang.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.