No warnings when database connection can't be established #4525

Closed
opened 2025-11-02 05:53:29 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @f0x52 on GitHub (Dec 20, 2019).

  • Gitea version (or commit ref): gitea-1.10.1-linux-amd64
  • Git version: 2.23.0
  • Operating system: Debian Sid
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Unbeknownst to me, my postgres crashed (probably out of disk space). This caused gitea to return 500 on any request in the web frontend. With no additional info on the gitea STDOUT, I decided to restart gitea.
It started up, gave the usual cli output, just like a normally running gitea process, without any indication that gitea was failing hard because it couldn't get a database connection.
This should really be visible error output, or even return the process because it can't start up correctly (it won't even start listening for network)

Originally created by @f0x52 on GitHub (Dec 20, 2019). - Gitea version (or commit ref): gitea-1.10.1-linux-amd64 - Git version: 2.23.0 - Operating system: Debian Sid - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Unbeknownst to me, my postgres crashed (probably out of disk space). This caused gitea to return 500 on any request in the web frontend. With no additional info on the gitea STDOUT, I decided to restart gitea. It started up, gave the usual cli output, just like a normally running gitea process, without any indication that gitea was *failing hard* because it couldn't get a database connection. This should really be visible error output, or even return the process because it can't start up correctly (it won't even start listening for network)
GiteaMirror added the issue/staleissue/needs-feedback labels 2025-11-02 05:53:29 -06:00
Author
Owner

@lunny commented on GitHub (Dec 20, 2019):

What's the output?

@lunny commented on GitHub (Dec 20, 2019): What's the output?
Author
Owner

@bagasme commented on GitHub (Dec 23, 2019):

I think Gitea should consider database connection errors as error, not warning.

@bagasme commented on GitHub (Dec 23, 2019): I think Gitea should consider database connection errors as *error*, not warning.
Author
Owner

@zeripath commented on GitHub (Dec 23, 2019):

2de8b27dd1/routers/init.go (L57-L78)

shows a lot of logging when there is errors...

@zeripath commented on GitHub (Dec 23, 2019): https://github.com/go-gitea/gitea/blob/2de8b27dd1a109e923af7e9026e541539ec054ed/routers/init.go#L57-L78 shows a lot of logging when there is errors...
Author
Owner

@guillep2k commented on GitHub (Jan 7, 2020):

@f0x52 maybe you mean to treat it as a fatal condition (i.e. shutdown the instance)? It's common for systems that the database is not yet ready when the instance starts (e.g. slow systems, remote systems), so Gitea performs many connection retries before failing.

@guillep2k commented on GitHub (Jan 7, 2020): @f0x52 maybe you mean to treat it as a _fatal condition_ (i.e. shutdown the instance)? It's common for systems that the database is not yet ready when the instance starts (e.g. slow systems, remote systems), so Gitea performs many connection retries before failing.
Author
Owner

@stale[bot] commented on GitHub (Mar 7, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 7, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4525