-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fix a regression in #223: sanitise selected closures #232
Conversation
Interesting, that fixes the bugs? I am surprised since I don't think those variables actually change outside the goroutine, so the value copied into the goroutines shouldn't be different than what is in the outer scope. |
This update does not fully fix it, only the |
@lxhao61 Let's continue our discussion here. Could you please explain how you're testing and what's exactly not working? I'm trying to simulate your config, and the Caddyfile below works fine for me with this PR, i.e. it's correctly responding to https://abc.caddy, https://def.caddy, and DNS requests sent over UDP to 127.0.0.1:443.
|
@lxhao61 I've copied your Caddyfile config and it seems to work fine for me. Both abc.caddy and def.caddy are accessible at port 443. I'm not sure how to test h3 on Windows localhost, but I doubt ff5d983 could have caused any regression with regards to quic support that hasn't been addressed by this PR. Please make sure you are testing Caddy with this PR and explain precisely what used to work and isn't working now for you. |
5470c65
to
c4d1d6e
Compare
@vnxme I know that the
I am absolutely sure that this is a bug introduced by ff5d983, and everything works fine after rolling back to b79350a. You can test it yourself. |
@lxhao61 OK, I've also tested http/3, and it also works with this PR. You didn't mention in your previous message that you actually tested this PR, only ff5d983 having a bug and b79350a. And I agree, rolling back to the latter will resolve your problem. But what about this PR? I've tested your config with the following docker images in https://hub.docker.com/r/vnxme/caddy/tags:
In case you would like to build your own Caddy with this PR, do like this:
@mholt, do you have any objections to merging this PR? |
I do not. I'm still a little confused as to how it actually fixes a problem 😅 since I'm not seeing where those variables would change from the time of the outer evaluation and the inner, but we can continue that discussion on Slack too. I was away this weekend and am just catching up :) |
OH, nevermind, I'm an idiot -- there are two loops! I see now that |
…208) * remove unnecessary routes matching and restore old fallback next handler behavior * fix embedded route list stuck * If a matcher returns false but some matcher before it needs more data, this match is eligible for retest. * use correct error when matching http * return error in case there is not enough data available * read data only when matchers need some to determine match status
I've tracked the regression in ff5d983 to at least 2 rows of the code ff5d983#diff-ba204f43657cfc2b9fd32beb6baad78efc8ca53ff8dfe9ad4eb748f8f9395e36R79 and ff5d983#diff-ba204f43657cfc2b9fd32beb6baad78efc8ca53ff8dfe9ad4eb748f8f9395e36R83.
This PR sanitises all the closures added in #223 and resolves the hanging connections bug.
I believe it will also resolve the problem reported by @lxhao61 in ff5d983#comments.