Skip to content

Random 500 error Invalid connection #5736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 7 tasks
lucableve opened this issue Jan 15, 2019 · 16 comments · Fixed by #5748
Closed
2 of 7 tasks

Random 500 error Invalid connection #5736

lucableve opened this issue Jan 15, 2019 · 16 comments · Fixed by #5748

Comments

@lucableve
Copy link

lucableve commented Jan 15, 2019

  • Gitea version (or commit ref): 1.7
  • Git version: 1.8.3.1
  • Operating system: Centos 7
  • Database (use [x]):
    • PostgreSQL
    • MySQL (MariaDB 10.2)
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Hi,
after gitea installation I have random 500 errors. The logs return this:
2019/01/15 01:59:48 [...itea/routers/home.go:138 RenderRepoSearch()] [E] SearchRepositoryByName: Count: invalid connection
2019/01/15 01:59:49 [...itea/routers/home.go:138 RenderRepoSearch()] [E] SearchRepositoryByName: Count: invalid connection
2019/01/15 02:00:25 [...itea/routers/home.go:138 RenderRepoSearch()] [E] SearchRepositoryByName: Count: invalid connection
2019/01/15 02:09:37 [.../gogits/cron/cron.go:92 Run()] [E] MirrorUpdate: invalid connection

I have this system: Nginx reverse proxy to gitea :3000 on Db mysql (engine : mariadb 12)

@lucableve
Copy link
Author

I have reinstalled vps and before gitea installing check into verbose log, random return 404 :
[Macaron] 2019-01-15 12:26:16: Completed GET /user/login 404 Not Found in 3.923679ms

my config nginx is :
server {
listen 51.77.202.209:80;
server_name xxxxx.com www.xxxxx.com;
error_log /var/log/httpd/domains/xxxxx.com.error.log error;

# reverse proxy
location / {
     proxy_pass http://127.0.0.1:3000/;
}

location ~ /\.ht    {return 404;}
location ~ /\.svn/  {return 404;}
location ~ /\.git/  {return 404;}
location ~ /\.hg/   {return 404;}
location ~ /\.bzr/  {return 404;}

include /home/vps/conf/web/nginx.xxxxx.com.conf*;

}

@zeripath
Copy link
Contributor

The http proxy isn't the connection that your errors are referring to. The problem appears to be with the communication between Gitea and the db. Does the xorm.log reveal anything?

@lucableve
Copy link
Author

lucableve commented Jan 15, 2019

xorm.log not have errors.
I forgot to tell you I have installed vestacp panel but
I have configured manually reverse proxy and db.

I started server gitea and this is log before first error invalid connection:

2019/01/15 13:16:57 [I] Log Mode: File(Info)
2019/01/15 13:16:57 [I] XORM Log Mode: File(Info)
2019/01/15 13:16:57 [I] Cache Service Enabled
2019/01/15 13:16:57 [I] Session Service Enabled
2019/01/15 13:16:57 [I] Git Version: 1.8.3.1
2019/01/15 13:16:57 [I] SQLite3 Supported
2019/01/15 13:16:57 [I] Run Mode: Production
2019/01/15 13:16:57 [I] Listen: http://0.0.0.0:3000
2019/01/15 13:17:57 [...s/context/context.go:235 func1()] [E] GetUserById: invalid connection

this is my db config app.ini

[database]
DB_TYPE = mysql
HOST = ip:3306 //Same problem with localhost and 127.0.0.1
NAME = name
USER = usr
PASSWD = psswd
SSL_MODE = disable
PATH = data/gitea.db

@zeripath
Copy link
Contributor

zeripath commented Jan 15, 2019

Ok your Gitea version doesn't make sense. We haven't released 1.8.3.1 that appears to be your git version which is quite old. I think that's the default version of git on centos 7 so it should be upgraded. If git has been upgraded Gitea doesn't appear to be using it. This was mentioned in another issue if you look for it.

The MariaDB version you're reported also doesn't quite make sense. There's also no version 12 of Maria dB.

@lucableve
Copy link
Author

I'm sorry , I have confused version, have fixed first comment.
Try update git version

@typeless
Copy link
Contributor

typeless commented Jan 16, 2019

By 'random' errors, do you mean some queries work fine? Did it fail with some types of queries and work for others?

@lunny
Copy link
Member

lunny commented Jan 16, 2019

That's an error from mysql driver. Maybe we should upgrade the driver library.

@lucableve
Copy link
Author

@typeless
on 10 attempts of the same query 2 return invalid connection randomly

@zeripath
Copy link
Contributor

May be there are dead connections in the pool?

@typeless
Copy link
Contributor

typeless commented Jan 16, 2019

@lucableve I guess @lunny was right. You may try to upgrade the driver library and see if that works.
I am not sure where the driver library in question is though.

Edit: probably this

Edit2: also go-sql-driver/mysql#836

@lucableve
Copy link
Author

Ok, I try this solution, update you

@lucableve
Copy link
Author

I downloaded binary master to test fix @lunny @zeripath but error occurs again.
Do I have to try the source version?

@luxiaok
Copy link

luxiaok commented Jan 22, 2019

The same error and situation kept a long time.

@samek
Copy link

samek commented Feb 14, 2019

With 1.7.1 is much better, but we still do get them.

@bobemoe
Copy link
Contributor

bobemoe commented May 15, 2019

I've been researching this over at #6804. I've tried Gitea 1.9-dev which should include the fix above, but still same issue.

I think @zeripath is right, dead connections in the pool. Watch mysql processlist, error happens straight after connection timeout (60s in my mysql.cnf)

But why did the update not work?

@zeripath
Copy link
Contributor

Because I suspect the connections are timing out due to deadlocks

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants