drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.62k stars 1.12k forks source link

Drogon fills up the whole hard drive with logs #1838

Closed xyious closed 6 months ago

xyious commented 1 year ago

Obviously if you constantly monitor things you should find the problem.... but I'm more of a "set it and forget it" girl. Also I was trying to find a job and didn't have time to work on websites for a few months....

The logs have 4 lines, but it starts a new log right away.

Full log: 20230810 09:39:29.576037 UTC 5773 INFO Start child process - HttpAppFrameworkImpl.cc:563 20230810 09:39:29.576246 UTC 5773 TRACE [createListeners] thread num=1 - ListenerManager.cc:92 20230810 09:39:29.576325 UTC 5773 TRACE [createNonblockingSocketOrDie] sock=11 - Socket.h:46 20230810 09:39:29.576342 UTC 5773 FATAL Address already in use (errno=98) , Bind address failed at 0.0.0.0:6666 - Socket.cc:67

I would solve this by keeping stats and aborting creating sockets after a number of failures (ideally 5 or less). Exponential back-off would work even better.

I don't know how to reproduce the issue since I just started the server months ago and left it alone until randomly checking it for unrelated reasons. I will try to investigate more, but helpful note: my website was actually online and working. So while the files I randomly checked were as above (IPv4), it's likely that IPv6 was working the whole time.

This command has been running for an hour and has deleted about 100 MiB at this point: find . -name "drogon.2309*.log" -exec rm -rf {} \;

hwc0919 commented 6 months ago

20230810 09:39:29.576342 UTC 5773 FATAL Address already in use (errno=98) , Bind address failed at 0.0.0.0:6666 - Socket.cc:67

This is because the port is already in use, as it says. You should choose a free port. It should be easy on a server.

The server aborts after failing to bind the port. Since you are using the daemon mode, it restarts over and over again.