Gitea: Error on startup 1.5

Created on 4 Jul 2018  路  30Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.5
  • Git version: 2.17.1
  • Operating system: Windows Server 2008 R2 Standard
  • Database (use [x]):

    • [ ] PostgreSQL

    • [ ] MySQL

    • [X] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [X] No

    • [ ] Not relevant

  • Log gist:

Description

Guys, a few minutes ago a tried to update 1.4.3 to 1.5 and the windows service doesn't start up.
log error:

2018/07/04 07:56:23 [I] Log Mode: File(Trace)
2018/07/04 07:56:23 [I] XORM Log Mode: File(Trace)
2018/07/04 07:56:23 [I] Cache Service Enabled
2018/07/04 07:56:23 [I] Session Service Enabled
2018/07/04 07:56:23 [I] Migration: add multiple assignees
2018/07/04 07:56:23 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table issue columns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id failed because one or more objects access this column.
...

Screenshots

kinbug stale statuneeds-feedback

Most helpful comment

If PR #4459 get's accepted and you still get the following error:

2018/07/17 20:37:42 [I] Migration: move team units to team_unit table
2018/07/17 20:37:42 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'

you may simply "drop table team_unit" and restart gitea.

All 30 comments

The CI for MSSQL could be added by https://github.com/go-gitea/gitea/pull/4282

@ymabispo can you check if code from pull request #4440 fixes your problem?

@lafriks I'm seeing a similar problem after updating from 1.4.1 to git-master, but with mysql.

```
[I] Gitea v8e103d3 built with: bindata, sqlite

@lafriks I guess commit e95417e fixes an issue for MSSQL but introduces an issue for MySQL.

I do see a similar problem as @bjoe2k4 but with migrating db v69 -> 70 as it seems that I'm already on a newer DB Version.

Error Message I get on first Start:

2018/07/17 20:29:18 [I] Migration: move team units to team_unit table
2018/07/17 20:29:19 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table team columns [unit_types]: sql: Transaction has already been committed or rolled back

Subsequent Starts will log (just in case anyone is googling for this error):

2018/07/17 20:37:42 [I] Migration: move team units to team_unit table
2018/07/17 20:37:42 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'

My first guess is that we simply need to open a new session:

Insert (after committing session):

sess.Close()
sess := x.NewSession()
defer sess.Close()

If PR #4459 get's accepted and you still get the following error:

2018/07/17 20:37:42 [I] Migration: move team units to team_unit table
2018/07/17 20:37:42 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'

you may simply "drop table team_unit" and restart gitea.

Getting this too..
2018/07/19 14:48:17 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop tableissuecolumns [assignee_id]: sql: Transaction has already been committed or rolled back

However, we're using postgres

I manually applied PR #4459 and it worked wonderfully!

@johanhugg could you try #4473 if it works?

I attempted updating today from 1.4.1 and had the same issue #4473 doesn't seem to fix it (Running on windows 10 pro box)

Hi , I attempted updating today from 1.4.3 to 1.5 and had the same issue #4360

2018/08/20 17:28:46 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop tableissuecolumns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id a 茅chou茅 car un ou plusieurs objets acc猫dent 脿 cette colonne.

( Windows Server 2008R2 , MSSQL 2012 )

thx for your help

Were you using final 1.5.0 release?

I have just updated from 1.4.1 to 1.5.0. Worked fine for me. So the error I received earlier (same as the one of @aurel-appsthru) seems to be resolved for me.

Edit: However there are a bunch of logs emitted on every restart, How to get rid of them?

gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table user Column allow_create_organization db default is 1, struct default is true
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table user Column prohibit_login db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table repository Column is_fork db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table repository Column is_fsck_enabled db default is 1, struct default is true
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table action Column is_deleted db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table action Column is_private db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table mirror Column enable_prune db default is 1, struct default is true
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table release Column is_draft db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table release Column is_prerelease db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table release Column is_tag db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table login_source Column is_actived db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table login_source Column is_sync_enabled db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table protected_branch Column can_push db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table protected_branch Column enable_merge_whitelist db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table user_open_id Column show db default is 0, struct default is false
gitea-1.5.0-linux-amd64[12494]: 2018/08/21 13:18:03 [W] Table comment has column old_assignee_id but struct has not related field

@lafriks : yes I tried with 1.5.0. The service start but stop on first refresh of a page.
I tried also 1.5 and master : service did not start, same log.

( Windows Server 2008R2 , MSSQL 2012 )

1.5.0 log :

2018/08/21 14:04:40 [I] Log Mode: File(Trace)
2018/08/21 14:04:40 [I] XORM Log Mode: File(Trace)
2018/08/21 14:04:40 [I] Cache Service Enabled
2018/08/21 14:04:40 [I] Session Service Enabled
2018/08/21 14:04:40 [I] Migration: add label descriptions
2018/08/21 14:04:42 [I] Migration: add merge whitelist for protected branches
2018/08/21 14:04:43 [I] Migration: add is_fsck_enabled column for repos
2018/08/21 14:04:45 [I] Migration: add size column for attachments
2018/08/21 14:04:45 [...ations/migrations.go:53 Migrate()] [E] calculate file size of attachment[UUID: 8162838b-76b5-410f-a546-3be9ae7d995e]: CreateFile E:\GitRepositories\attachments/8/1/8162838b-76b5-410f-a546-3be9ae7d995e: Le chemin d鈥檃cc猫s sp茅cifi茅 est introuvable.
2018/08/21 14:04:45 [I] Migration: add last used passcode column for TOTP
2018/08/21 14:04:45 [I] Migration: add language column for user setting
2018/08/21 14:04:45 [I] Migration: add multiple assignees
2018/08/21 14:04:45 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table issue columns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id a 茅chou茅 car un ou plusieurs objets acc猫dent 脿 cette colonne.

1.5 and master log :

2018/08/21 14:07:52 [I] Log Mode: File(Trace)
2018/08/21 14:07:52 [I] XORM Log Mode: File(Trace)
2018/08/21 14:07:52 [I] Cache Service Enabled
2018/08/21 14:07:52 [I] Session Service Enabled
2018/08/21 14:07:52 [I] Migration: add multiple assignees
2018/08/21 14:07:52 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table issue columns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id a 茅chou茅 car un ou plusieurs objets acc猫dent 脿 cette colonne.

@lafriks I'm still getting the migration issue with the new 1.5.0 binary as well

2018/08/28 09:43:25 [I] Migration: add multiple assignees
2018/08/28 09:43:25 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table issue columns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id failed because one or more objects access this column.

Tried running the alter drop column manually in mssql to see if I got a more descriptive error. Turns out we've got an index IDX_issue_assignee_id hanging around getting in the way.

Msg 5074, Level 16, State 1, Line 7
The index 'IDX_issue_assignee_id' is dependent on column 'assignee_id'.
Msg 4922, Level 16, State 9, Line 7
ALTER TABLE DROP COLUMN assignee_id failed because one or more objects access this column.

Manually deleting the index and rerunning the upgrade finished successfully

@lafriks @tenacubus
Hi, deleting the index manually, it works.

DROP INDEX [IDX_issue_assignee_id] ON [dbo].[issue]

thx a lot

@lafriks I received the same error as @aurel-appsthru and @tenacubus
when updating from 1.4.1 to 1.5.1 running on MSSQL 2016.

Dropping the index DROP INDEX [IDX_issue_assignee_id] ON [dbo].[issue] allowed the migration to run through

Maybe this should be treated as separate issue as this original error in this issue seems to be different

@leepfrog-ger I'd say we should reopen this issue as the initial error was the exact one I had. Additionally the initial poster never confirmed it fixed their problem. Hey @ymabispo did you ever try it?

What do you think @lafriks? I don't know the policy as far as reopening issues or creating a new one.

I see the mssql code in DropTableColumns only looks for and deletes constraints but does not address indexes
https://github.com/go-gitea/gitea/blob/6e64f9db8eb889f9cc7e8c9576b2f9c89750927e/models/migrations/migrations.go#L269-L298

@tenacubus you are right, I mixed up something, I've also got the same errors as in the initial issue. so the reopening is fine with me.

Hi guys, sorry about the late response.
I've been using gitea to manage very important repositories, so i can not try a new update without any confirmation about the integrity of this new version.

Thanks

is there any update on 1.5.2 issues? E.g. this issue looks like critical and I'm scaring of upgrading to latest 1.5 version (from 1.4)

Thanks in advance

@davydov-vyacheslav it only affects instamces running mssql database

ok. thank you

I'm on version 1.4.3 and i tried to delete manually using DROP INDEX [IDX_issue_assignee_id] ON [dbo].[issue]
and now i'm stuck in a timeout while applying another migration "[I] Migration: remove stale watches"

i've tried to migrate from 1.4.3 to 1.5, 1.5.1, 1.5.3 and 1.6 allways restoring the database and runing all the way through.

I think there was some mssql fixes for migrations. Is this still an unresolved issue?

i just tried update from 1.4.3 to 1.6.2 and i got:

2018/12/27 14:02:34 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Drop table issue columns [assignee_id]: mssql: ALTER TABLE DROP COLUMN assignee_id failed because one or more objects access this column.

and i droped the index on issue table:
DROP INDEX [IDX_issue_assignee_id] ON [dbo].[issue]

then i got more migrations applied:
2018/12/27 14:06:38 [I] Migration: add multiple assignees
2018/12/27 14:06:38 [I] Migration: add u2f
2018/12/27 14:06:39 [I] Migration: add login source id column for public_key table

and got a timeout...
2018/12/27 14:06:42 [I] Migration: remove stale watches
2018/12/27 14:07:13 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: read tcp 10.100.4.98:57151->10.200.5.108:1433: i/o timeout

Still can't evolve my version...

Guys, anyone to help us? We are still having trouble updating gitea version 1.4.3 to version 1.7 motivated by this error in mssql. Will there be any correction for this?

capturar

As i said in my last comment here, after i dropped the index on issue table i got a timeout.

Watching a more detailed log i saw the timeout in this statement: SELECT * FROM "watch" WHERE (id NOT IN (SELECT TOP 50 id FROM "watch"))

So i decided to delete all the data in the watch table and tried to update from 1.4.3 to 1.7.1 and it was ok in my test environment, i'll do it in production environment tomorrow morning and send an e-mail telling everyone to click watch button in the repository they want to follow.

The problem with the update has something to do with the data that was in this table...

Some migrations depends on how many rows of that table. It may timeout on some situations.

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.

This issue has been automatically closed because of inactivity. You can re-open it if needed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jorise7 picture jorise7  路  3Comments

lunny picture lunny  路  3Comments

thehowl picture thehowl  路  3Comments

kolargol picture kolargol  路  3Comments

BNolet picture BNolet  路  3Comments