gitea: Unable to access repos after going from 1.15.0 => 1.15.2
- Gitea version (or commit ref): 1.15.2
- Git version: 2.33.0
- Operating system: Ubuntu 20.04.2 using systemd and Gitea downloaded from the github releases page (amd64 build)
- Database (use
[x]
):- PostgreSQL
- [ x] MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- [ x] No
- Log gist:
2021/09/05 09:58:23 ...ules/context/repo.go:343:repoAssignment() [E] GetUserRepoPermission: skipObjectDecoder: expect object or null, error found in #0 byte of ...|&\003d{\003d}\003d|..., bigger context ...|&\003d{\003d}\003d|... 2021/09/05 09:54:32 ...ters/private/serv.go:293:ServCommand() [E] Unable to get permissions for 3:REMOVED with key 8 in 2:ORG/myrepo Error: skipObjectDecoder: expect object or null, error found in #0 byte of ...|&\003d{\003d}\003d|..., bigger context ...|&\003d{\003d}\003d|... 2021/09/05 09:54:33 modules/ssh/ssh.go:140:sessionHandler() [E] SSH: Wait: exit status 1
Description
When logging in, I am able to see all commits on the dashboard to repos I have access to, but the right side repos card is empty and missing all repos that I have access to. When selecting to view a repo, I get a 500 error with the error above logged. Rolling back to 1.15.0 and everything returns to normal.
SSH access also fails with errors as well as shown above.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (18 by maintainers)
Links to this issue
Commits related to this issue
- Add repounit fixer for #16961 Unfortunately a number of people appear to have been bitten by the bug in the dump command. This PR adds a doctor command to attempt to fix the broken repo_units Fix #... — committed to zeripath/gitea by zeripath 3 years ago
- Add repounit fixer for #16961 (#17136) Backport #17136 Unfortunately a number of people appear to have been bitten by the bug in the dump command. This PR adds a doctor command to attempt to fix th... — committed to zeripath/gitea by zeripath 3 years ago
- Create doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 (#17136) There was a serious issue with the `gitea dump` command in 1.14.3-1.14.6 which led to corruption of the `config` fi... — committed to go-gitea/gitea by zeripath 3 years ago
- Create doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 (#17136) (#17137) Backport #17136 There was a serious issue with the `gitea dump` command in 1.14.3-1.14.6 which led to c... — committed to go-gitea/gitea by zeripath 3 years ago
A simple work around is to run
UPDATE repo_unit set config = "{}"
, but you will lose some special settings of repository, you can change the setting again in repository settings page. WARN: Please back up the table before you executed above SQL.I’ve spent this evening attempting to write a doctor command that would be able to fix these issues.
It’s a substantial amount of work - and although it should fix the repo_units issue the login_sources also need to be fixed - Those are a substantially more difficult proposition.
I’ve pushed up a backport of it to 1.15.
People suffering this issue - Please could you take a backup of the repo_unit table, build the PR (backport if you’re on 1.15) and then run the doctor command
gitea doctor --fix --run fix-broken-repo-units
and report if this solves your issue.If you require builds of PRs you should contact me or another developer on discord.
@echodreamz when we looked at this together both with your db and me looking at the code we found the following options for
config
field in therepo_unit
table:Type 6 - External Wiki Configuration
The broken form looks like:
but should be:
Type 7 - External Tracker Configuration
The broken form looks like:
But should be:
The problem will be if there are spaces in this one.
Type 3 - Pull Request Configuration
The broken form has two types 1.14:
and 1.15:
But should be:
Type 2 - Issue Configuration
Broken looks like:
But should be:
Others
Should just be
The related code is:
https://github.com/go-gitea/gitea/blob/63d7cbcef13b4eb719a5749a1a79361461c77135/models/repo.go#L399-L431
I’m saying there was a serious regression in 1.14.3-1.14.6 that meant the dumps were broken for these two columns but no one noticed. Certainly having spent so damned long making sure that they worked in the first place I didn’t expect that they would suffer a regression like that.
I’ve fixed that regression and added a test to stop it from happening again, however we clearly need to add a stronger testsuite to the dumping behaviour as this test only covers a very small component.
I’m glad that your repo_units config column appeared so easily fixable but I’m surprised it was empty. Have you been consistently restoring from backups? My suspicion is you’ve lost some configuration data here. We need to check your older backups - please contact me on discord or on matrix.
It may not be coming across but I’m seriously and very deeply sorry and annoyed about this. It’s just not good enough that this has happened. If we’re gonna supply a dump command it should bloody well work.