-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Error 500 on comment creation via API, with sudo #5871
Comments
I've tried this on try.gitea.org but I can't get to use |
Another strange fact : I can create issues with |
It's de-referencing null because ctx.User isn't actually set Nasty. I've put in a PR to fix this. |
OK, I think I've spotted a different bug, because I wasn't actually properly logging in... So I was getting a null pointer - which is bad enough to require a patch in itself... |
I'm not able to completely replicate your issue on master. Let me check on 1.7.0 |
Is there a special mode I can run my instance with to help you debug this ? |
Hmm... I can't replicate with a valid token. I can get a 500 if the token is invalid though and I've just put a PR in for that. Are you sure that your token is correct? |
Is there something special about that issue? |
I guess you aren't getting the above nil dereference error? |
As far as I can tell, my token is working. |
If you're getting a ROLLBACK then something is causing a conflict in the database - which is very odd. |
It's working perfectly with |
I suspect its something to do with my fixing of deadlocks patches. There's a cascade of actions that come after the creation of an issue comment. I wonder if one of them isn't working within the session... |
It's also OK with |
OK presumably the conflict is occurring in here: https://github.com/go-gitea/gitea/blob/master/models/issue_comment.go#L544 |
Do you have watchers on your issue or have webhooks? |
No watchers on the comment. There is also no webhooks nor Git hooks. |
There's nothing trying to post at the same time is there? Maybe you're both trying to post at the same time although there really should be an error thrown back to you. |
Could you post your db log with the rollback in it? And what dB are you using? |
I don't think anything tries to post at the same time. It's a procedural script. Here is the DB log :
|
That's necessary |
No. It shouldn't be that. It could be this Line 90 in 6311e4c
That loads the repository outside of the transaction. |
Are you asking me to download the source code, comment the If so, I need instructions because I’ve never compiled a Go project yet. |
You probably have only just started noticing it because I might have missed it in my deadlock fixing set which probably moved the notifyWatchers bit into the transaction. |
If you want it fixed today, yes. I'm afraid it's almost midnight here and I'm going to bed. My day job is very different from coding so I won't be able to hack until the evening. The Line 117 in 7d65ddf
Go isn't that hard - it's yet another imperative language with a garbage collector. If it helps, up until my first patch in August I had never written a line of it. There's some instructions on Gitea.io. See if you can recruit some help on discord too. Otherwise I can fix it tomorrow. Hopefully I've identified the right bug so it should be quick to sort. PS it's no longer a comment out the block btw, the act.loadrepo code needs to be pulled within the transaction by passing the session e in and using that. If no session is available then you can pass in x and it will work. |
https://docs.gitea.io/en-us/install-from-source/ is the basic build instructions. |
@zeripath Hey, I'm sorry if I was a bit blunt. I did not expect anything, and certainly not to have it fixed and delivered for free the same day. I'm not sure that I'll be able to setup a test instance of gitea to try the proposed fix without impacting my production instance. I can stay on 1.6.4 until this is properly investigated and fixed. I will report if I can do more on my side. Thanks again. |
OK, so looking at this again. The What is interesting though is that your xorm.log appears to effectively call notifyWatchers twice. |
AHA! It's this https://github.com/go-gitea/gitea/blob/release/v1.7/models/issue_comment.go#L635 - which is not in master. |
@zeripath Good news ! Which commit/tag/branch should I try to compile and run ? |
@jlecour Master branch |
OK, compiling Gitea was really easy ! I've verified that master doesn't have the bug I've found anymore. Thanks you @zeripath you've been amazing ! If by any chance you are at FOSDEM in Brussels next weekend, I'd be happy to thank your personally. |
No worries. Afraid I won't be at fosdem unfortunately, never been. I'll have another think about this bug - I suspect that others were likely to be hit by it - it's likely to be in the mail creation scripts but I can't seem to replicate it. Tell me what dB are you using? I guess you've got email switched on too? |
I've been using MySQL and yes I have mail notifications enabled. |
This is probably actually the bug in #5891 - well when it's backported. |
[x]
):Description
I've been using the API to import projects and issues from Redmine/Gitolite to Gitea (it will be open sourced soon).
For a few days I've been using a Gitea instance with a version < 1.7 and it seemed to work really well. I could create issues and comments on repositories, with or without the
Sudo
header.It seems that after the 1.7 upgrade I can't use
Sudo
anymore.My request fail if I add the HTTP header. I get the same error with the query string parameter.
Examples :
Obviously
other_user
exists and is a collaborator on the repository withWrite
permission.In the logs, I only get SQL logs with a failed transaction (ROLLBACK). I've executed each request manually against my database and I get no error, so I guess the faulty request is not logged.
I'm not sure if it's a bug or if I did something wrong.
Is there a way to have more information about the error ?
The text was updated successfully, but these errors were encountered: