Gitea: Unable to push to an existing repo after upgrade to 1.0.0+294-g04fdeb9d (on Postgres 9.6)

Created on 20 Feb 2017  路  23Comments  路  Source: go-gitea/gitea

Description

After pulling latest gitea Docker image we are unable to push to an existing and new repo. Reverting back to gitea/gitea:1.0.1 fixes this.
We use internal SSH-Server provided by Gitea.

kinbug

All 23 comments

@bkleef please help to confirm #993 fix this.

@lunny thanks a lot for the fix. It doesn't work yet:

core@gogs1 ~ $ journalctl -f -u gogs
-- Logs begin at Sat 2016-11-05 00:31:12 UTC. --
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [T] Custom path: /etc/gogs
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [T] Log path: /var/log/gogs
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] Gitea v1.0.0+297-gffde33bd
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] Log Mode: Console(Info)
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] XORM Log Mode: Console(Info)
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] Cache Service Enabled
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] Session Service Enabled
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] PING DATABASE postgres
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] SELECT tablename FROM pg_tables WHERE tablename = $1 [args] [version]
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I][sql]SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $1 AND column_name = $2[version id]
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I][sql]SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = $1 AND column_name = $2[version version]
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] SELECT "id", "version" FROM "version" WHERE "id"=$1 LIMIT 1 [args] [1]
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] SELECT * FROM "repository"
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] Migration: create repo unit table and add units for all repos
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] BEGIN TRANSACTION
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] CREATE TABLE IF NOT EXISTS "repo_unit" ("id" BIGSERIAL PRIMARY KEY  NOT NULL, "repo_id" BIGINT NULL, "type" INTEGER NULL, "index" INTEGER NULL, "config" JSON NULL, "created_unix" BIGINT NULL)
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] CREATE INDEX "IDX_repo_unit_S" ON "repo_unit" ("repo_id","type");
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [I] [sql] ROLL BACK
Feb 21 13:07:47 gitea.example.com sh[20283]: 2017/02/21 13:07:47 [...itea/routers/init.go:54 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: CreateIndexes RepoUnit: pq: relation "IDX_repo_unit_S" already exists

@bkleef, that's another issue. not this one.

@lunny I can create another one if you want but this one prevents Gitea from listening on HTTP(S)/SSH and so I'm unable to test your fix.

Looks like I hit #854.

@bkleef, please create another one. do you upgrade from Gogs? which version have you on?

@lunny when I create a new repo in version 1.0.0+297-gffde33bd and run the following commands:

mkdir test
cd test
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://gitea.example.com/profects/test.git
git push -u origin master

The following error occurs:

Counting objects: 3, done.
Writing objects: 100% (3/3), 236 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x55ad7cafc407]
remote:
remote: goroutine 1 [running]:
remote: panic(0x55ad7ddda100, 0xc420014060)
remote:     /usr/lib/go/src/runtime/panic.go:500 +0x1a5
remote: code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc420187099, 0x1, 0x1)
remote:     /srv/app/src/code.gitea.io/gitea/modules/log/xorm.go:127 +0x17
remote: code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc420123400, 0xc420187099, 0x1, 0x1)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:51 +0x54
remote: code.gitea.io/gitea/models.SetEngine(0xc420223801, 0x18)
remote:     /srv/app/src/code.gitea.io/gitea/models/models.go:258 +0x1ce
remote: code.gitea.io/gitea/cmd.setup(0x55ad7d65ad58, 0xa, 0x6, 0xc4200f1140)
remote:     /srv/app/src/code.gitea.io/gitea/cmd/serve.go:63 +0x14d
remote: code.gitea.io/gitea/cmd.runUpdate(0xc4201ab900, 0x0, 0xc4201ab900)
remote:     /srv/app/src/code.gitea.io/gitea/cmd/update.go:37 +0x7d
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x55ad7dda6dc0, 0x55ad7ded6600, 0xc4201ab900, 0xc42000ce00, 0x0)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xbb
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x55ad7d652c5a, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x55ad7d691da9, 0x2e, 0x0, ...)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xcc9
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc420279520, 0xc42000c0c0, 0x6, 0x6, 0x0, 0x0)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x6a5
remote: main.main()
remote:     /srv/app/src/code.gitea.io/gitea/main.go:39 +0x356
remote: error: hook declined to update refs/heads/master
To https://gitea.example.com/profects/test.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'https://gitea.example.com/profects/test.git'

Where UI shows:

But when clicking on the newly created repo:

Logs when clicking on newly created repo:

Feb 21 14:17:53 gitea.example.com sh[26549]: [Macaron] 2017-02-21 14:17:53: Started GET /profects/test for 83.162.217.172
Feb 21 14:17:53 gitea.example.com sh[26549]: 2017/02/21 14:17:53 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 [args] [1]
Feb 21 14:17:53 gitea.example.com sh[26549]: 2017/02/21 14:17:53 [I] [sql] SELECT count(*) FROM "notification" WHERE user_id = $1 AND status = $2 [args] [1 1]
Feb 21 14:17:53 gitea.example.com sh[26549]: 2017/02/21 14:17:53 [I] [sql] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "lower_name"=$1 LIMIT 1 [args] [profects]
Feb 21 14:17:53 gitea.example.com sh[26549]: 2017/02/21 14:17:53 [I] [sql] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "created_unix", "updated_unix" FROM "repository" WHERE "owner_id"=$1 AND "lower_name"=$2 LIMIT 1 [args] [2 test]
Feb 21 14:17:54 gitea.example.com sh[26549]: 2017/02/21 14:17:54 [I] [sql] SELECT "id", "user_id", "repo_id" FROM "watch" WHERE "user_id"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 140]
Feb 21 14:17:54 gitea.example.com sh[26549]: 2017/02/21 14:17:54 [I] [sql] SELECT "id", "uid", "repo_id" FROM "star" WHERE "uid"=$1 AND "repo_id"=$2 LIMIT 1 [args] [1 140]
Feb 21 14:17:54 gitea.example.com sh[26549]: [Macaron] 2017-02-21 14:17:54: Completed /profects/test 500 Internal Server Error in 83.356814ms
Feb 21 14:17:54 gitea.example.com sh[26549]: 2017/02/21 14:17:54 [...ules/context/repo.go:308 func1()] [E] GetBranches: exit status 1
Feb 21 14:17:54 gitea.example.com sh[26549]: [Macaron] 2017-02-21 14:17:54: Started GET /img/favicon.png for 83.162.217.172
Feb 21 14:17:54 gitea.example.com sh[26549]: [Macaron] [Static] Serving /img/favicon.png
Feb 21 14:17:54 gitea.example.com sh[26549]: [Macaron] 2017-02-21 14:17:54: Completed /img/favicon.png 200 OK in 7.912571ms

You should update to 70ae6d197b28f018264798b07a16bf3acc36405c not ffde33bdfabceb69ac2bdf43466cc0508fec0add and then test it.

@lunny what I did based on https://drone.gitea.io/go-gitea/gitea/1776:

docker pull gitea/gitea@sha256:316f5c635a3eb566a131f92d3a7f1e7872de2dfc58775ef0d8ada8b81957ab1b

On version 1.0.0+298-g70ae6d19:

remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x55e7faad7407]
remote:
remote: goroutine 1 [running]:
remote: panic(0x55e7fbdb50c0, 0xc420014060)
remote:     /usr/lib/go/src/runtime/panic.go:500 +0x1a5
remote: code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc420083099, 0x1, 0x1)
remote:     /srv/app/src/code.gitea.io/gitea/modules/log/xorm.go:127 +0x17
remote: code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc420125360, 0xc420083099, 0x1, 0x1)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:51 +0x54
remote: code.gitea.io/gitea/models.SetEngine(0xc420221801, 0x18)
remote:     /srv/app/src/code.gitea.io/gitea/models/models.go:258 +0x1ce
remote: code.gitea.io/gitea/cmd.setup(0x55e7fb635d78, 0xa, 0x6, 0xc4200f3160)
remote:     /srv/app/src/code.gitea.io/gitea/cmd/serve.go:63 +0x14d
remote: code.gitea.io/gitea/cmd.runUpdate(0xc4201ab900, 0x0, 0xc4201ab900)
remote:     /srv/app/src/code.gitea.io/gitea/cmd/update.go:37 +0x7d
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x55e7fbd81d80, 0x55e7fbeb15c0, 0xc4201ab900, 0xc42000ce00, 0x0)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xbb
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x55e7fb62dc7a, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x55e7fb66cdb5, 0x2e, 0x0, ...)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xcc9
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc420279520, 0xc42000c0c0, 0x6, 0x6, 0x0, 0x0)
remote:     /srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x6a5
remote: main.main()
remote:     /srv/app/src/code.gitea.io/gitea/main.go:39 +0x356
remote: error: hook declined to update refs/heads/master

It's strange. I just test on https://try.gitea.io/lunny/tango via SSH clone and push, both are right.

@lunny it works for me as well over HTTPS https://try.gitea.io/bkleef/test. Does it run on Postgres 9.6 as well?

No. It's run the latest docker. Use a default sqlite database.

@lunny well sounds like this only occurs on Postgres (9.6) than. Please reopen this issue and let me know if you need any more details.

Gitea version: 1.0.0+300-gfd941db2.

This also happens with MySQL.

HTTP(s):

remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x8665a7]
remote: 
remote: goroutine 1 [running]:
remote: code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc4201b110f, 0x1, 0x1)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/modules/log/xorm.go:127 +0x17
remote: code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc4201c97c0, 0xc4201b110f, 0x1, 0x1)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:51 +0x52
remote: code.gitea.io/gitea/models.SetEngine(0xc420122a01, 0x19)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/models/models.go:258 +0x1c5
remote: code.gitea.io/gitea/cmd.setup(0x1532d67, 0xa, 0x6, 0x7ffcd95e4e60)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/cmd/serve.go:63 +0x212
remote: code.gitea.io/gitea/cmd.runUpdate(0xc4200de280, 0x0, 0xc4200de200)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/cmd/update.go:40 +0x7e
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x133b9a0, 0x15b90e0, 0xc4200de280, 0xc420405000, 0x0)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb9
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x152aa17, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x156b7e4, 0x2e, 0x0, ...)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xb4b
remote: code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc420001d40, 0xc420010120, 0x6, 0x6, 0x0, 0x0)
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x65f
remote: main.main()
remote:     /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/main.go:39 +0x377
remote: error: hook declined to update refs/heads/master

SSH:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x8665a7]

goroutine 1 [running]:
code.gitea.io/gitea/modules/log.(*XORMLogBridge).ShowSQL(0x0, 0xc42013931f, 0x1, 0x1)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/modules/log/xorm.go:127 +0x17
code.gitea.io/gitea/vendor/github.com/go-xorm/xorm.(*Engine).ShowSQL(0xc420195540, 0xc42013931f, 0x1, 0x1)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/go-xorm/xorm/engine.go:51 +0x52
code.gitea.io/gitea/models.SetEngine(0xc42011ea01, 0x17)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/models/models.go:258 +0x1c5
code.gitea.io/gitea/cmd.setup(0x152ec18, 0x8, 0x6, 0x7ffff4ca2de7)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/cmd/serve.go:63 +0x212
code.gitea.io/gitea/cmd.runServ(0xc4200e0280, 0x0, 0xc4200e0200)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/cmd/serve.go:149 +0x7e
code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x133b9a0, 0x15b90d8, 0xc4200e0280, 0xc42040d000, 0x0)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb9
code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x1526ec2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x156c73d, 0x2f, 0x0, ...)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xb4b
code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc4204591e0, 0xc420010240, 0x4, 0x4, 0x0, 0x0)
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x65f
main.main()
    /home/jomp16/sources/gitea-git/src/src/code.gitea.io/gitea/main.go:39 +0x377
fatal: Could not read from remote repository.

Reverting commits: 70ae6d197b28f018264798b07a16bf3acc36405c and 04fdeb9d8d4dc3cf296d8354ee29f1d053154a54 makes it work again.

I'm not sure why it works on try.gitea.io and not on my side. The only difference the database engine is MySQL (MariaDB to be more exact) on my side instead of SQLite on your side.

I will check this.

@jomp16 what's your log mode

[log]
MODE      = console, file

I have tested mysql 5.7.16 on macosx. I can't reproduce it.

Found where the problem is. You have to put more than 1 log mode in your config file except console.

@bkleef @jomp16 Please confirm this is resolved by #1007

@lunny this indeed works:

[log]
MODE      = console, file

Whenever the build is finished I will test it again without , file.

OK. Thanks!

This indeed works. Thank you!

[log]
ROOT_PATH  = /var/log/gitea
; Either "console", "file", "conn", "smtp" or "database", default is "console"
; Use comma to separate multiple modes, e.g. "console, file"
MODE       = console
; Buffer length of channel, keep it as it is if you don't know what it is.
BUFFER_LEN = 10000
; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
LEVEL      = Info

Since journalctl already fetch the output of console log, I think it's irrelevant to save the logs to file.

You are welcome.

@lunny it works here as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fastidious picture Fastidious  路  3Comments

adpande picture adpande  路  3Comments

kifirkin picture kifirkin  路  3Comments

BNolet picture BNolet  路  3Comments

tuxfanou picture tuxfanou  路  3Comments