-
-
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
1.18.0 on Windows error: can not resolve localhost, ! [remote rejected] master -> master (pre-receive hook declined) #22370
Comments
Could you |
Workaround: set LOCAL_ROOT_URL with 127.0.0.1, do not use localhost |
yes |
I can't find a LOCAL_ROOT_URL in app.ini, should I add it at somewhere? |
Please check the documentation. |
Thank you very much! Success! By the way, english version documentation has this LOCAL_ROOT_URL but chinese version not. |
it does not work for me |
it work for me
|
workaround: LOCAL_ROOT_URL = http://127.0.0.1:3000/ |
Is your problem the same as others? |
So leaving aside the workaround which I am sure will fix the issues people are describing - I don't understand why it is needed or what has changed to make it needed. As far as I can see the determination of the value of So I don't understand why this should suddenly be a problem... |
For others seeing this conversation the |
Hey @jinyangcruise
|
I think this issue should be re-opened and it needs a patch. To make the workaround prominent, I didn't say too much about my guess before. Here is my opinion of this bug: How it happens?Gitea (Golang net package) can not resolve host Golang's net package need correct Why there are so many reports recently?Possibility 1Alpine / Go or Go for Windows changed some behaviors which conflict with user's environment, then Golang's net package doens't work well in some rare cases (no evidence yet). But since some users reported that 1.17.x works but 1.18.x fails, maybe there is something changed. Possibility 2Many users' systems were already broken, they messed up their Before, some public DNS servers can also resolve
Recently some public DNS servers might have stopped such non-standard behavior, if they do not resolve localhost anymore, the users with broken localhost definition will encounter the problem. So, some users with broken The patchApproach 1Use
Approach 2Find the root case why 1.17.x works but 1.18.x doesn't. Update: maybe it's a Go 1.19 bug: golang/go#53490 And: https://tip.golang.org/doc/go1.19#net
Removing the Approach 3Try to resolve |
We could use 127.0.0.1 instead of localhost only on windows then we get none of the cons. |
But yes I agree I think this was closed too soon and we need to add a patch - if not for the users, then just to save ourselves time. |
@zeripath
gitea.log |
Same problem for me, windows install, for unknown reason problem raised today, yesterday it was ok. @DuaneDu , add DEV run mode, client will show bit more detailed error message |
@DuaneDu your logs now indicate that things are should now be working correctly for you. Your pre-receive hook is being declined by the user does not have permission to that repo |
I think it's related to this Go bug:
And: https://tip.golang.org/doc/go1.19#net
Removing the |
This webhook error may be related to this issue.
https://gist.github.com/natsutteatsuiyone/4c7b8e3b444a61080bb04ece20b316aa |
RUN_MODE=dev RUN_MODE=test |
It certainly appears that the upstream DNS server it is discovering is doing the incorrect thing for at least localhost...
I guess the question is what does the netgo tag do on Windows build and is it really necessary to make a "static" build with it for windows? Removing netgo here: Lines 759 to 764 in 16e9dec
would create "Static" builds for windows without the use of netgo. |
I guess an option is to ask users who are affected if they can run Gitea with the environment variable GODEBUG=netdns=cgo gitea web That should force the use of the win32 api. |
I have reported the bug to Go team (it has been confirmed as NeedsFix there)
I guess the And, the So, IMO it's good to remove the |
Agreed I've just looked up the source code for golang and I've come to the same conclusion. netgo only affects lookup on windows and previously was a no-op. Therefore we can and should safely remove until/unless go can make it work correctly. Are you able to send a PR @wxiaoguang ? |
As an aside I suspect the problem is here: if c.netGo || r.preferGo() {
switch c.goos {
case "windows":
// TODO(bradfitz): implement files-based
// lookup on Windows too? I guess /etc/hosts
// kinda exists on Windows. But for now, only
// do DNS.
fallbackOrder = hostLookupDNS
default:
fallbackOrder = hostLookupFilesDNS
}
} That code cannot check the /etc/hosts file and thus I bet the dns lookup is going out to an external server and we're getting the external name for the host. |
Backport #22467 Fix #22370 and more. Before Go 1.19, the `netgo` tag for Windows does nothing. But Go 1.19 rewrite the net package code for Windows DNS, and there is a bug: * golang/go#57757 This PR just removes the `netgo` tag for Windows build, then the Gitea for Windows can have the old DNS behavior.
Fix #22370 and more. Before Go 1.19, the `netgo` tag for Windows does nothing. But Go 1.19 rewrite the net package code for Windows DNS, and there is a bug: * golang/go#57757 This PR just removes the `netgo` tag for Windows build, then the Gitea for Windows can have the old DNS behavior.
DESCRIPTIONThis bug is due to a change in Go's handling of the We were bitten by this because we build our static precompiled binaries with #22467 and #22468 should fix this for 1.18-dev, 1.18.1 and 1.19-dev. WORKAROUNDFor 1.18.0 set the Builds of what will become 1.18.1 are available now on https://dl.gitea.io/gitea/1.18 |
Description
Save your time:
Detailed:
I use 1.18.0 Gitea, when I push files, occur:
I searched some related issues but finally failed to fix this.
Then I installed 1.17.4 Gitea and this problem gone.
Then I re-installed 1.18.0 Gitea again and still can not push.
Gitea Version
1.18.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
NA
Git Version
git version 2.39.0.windows.2
Operating System
WINDOWS 11
How are you running Gitea?
download binary on https://dl.gitea.io/gitea
[gitea-1.18.0-windows-4.0-amd64.exe]
download it on my PC and move it to D:\Program Files\Gitea, then double click the gitea-1.18.0-windows-4.0-amd64.exe
Database
SQLite
The text was updated successfully, but these errors were encountered: