diff --git a/go.mod b/go.mod index fb730a385c..3c08c76d27 100644 --- a/go.mod +++ b/go.mod @@ -198,7 +198,7 @@ require ( go.opencensus.io v0.24.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220827204233-334a2380cb91 // indirect golang.org/x/mod v0.8.0 // indirect - golang.org/x/net v0.16.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/go.sum b/go.sum index 8f91d58713..5e6b3b98a1 100644 --- a/go.sum +++ b/go.sum @@ -1866,8 +1866,9 @@ golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.16.0 h1:7eBu7KsSvFDtSXUIDbh3aqlK4DPsZ1rByC8PFfBThos= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index de60fa88f1..02c88b6b3e 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -581,9 +581,11 @@ type serverConn struct { advMaxStreams uint32 // our SETTINGS_MAX_CONCURRENT_STREAMS advertised the client curClientStreams uint32 // number of open streams initiated by the client curPushedStreams uint32 // number of open streams initiated by server push + curHandlers uint32 // number of running handler goroutines maxClientStreamID uint32 // max ever seen from client (odd), or 0 if there have been no client requests maxPushPromiseID uint32 // ID of the last push promise (even), or 0 if there have been no pushes streams map[uint32]*stream + unstartedHandlers []unstartedHandler initialStreamSendWindowSize int32 maxFrameSize int32 peerMaxHeaderListSize uint32 // zero means unknown (default) @@ -981,6 +983,8 @@ func (sc *serverConn) serve() { return case gracefulShutdownMsg: sc.startGracefulShutdownInternal() + case handlerDoneMsg: + sc.handlerDone() default: panic("unknown timer") } @@ -1020,6 +1024,7 @@ var ( idleTimerMsg = new(serverMessage) shutdownTimerMsg = new(serverMessage) gracefulShutdownMsg = new(serverMessage) + handlerDoneMsg = new(serverMessage) ) func (sc *serverConn) onSettingsTimer() { sc.sendServeMsg(settingsTimerMsg) } @@ -2017,8 +2022,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) } - go sc.runHandler(rw, req, handler) - return nil + return sc.scheduleHandler(id, rw, req, handler) } func (sc *serverConn) upgradeRequest(req *http.Request) { @@ -2038,6 +2042,10 @@ func (sc *serverConn) upgradeRequest(req *http.Request) { sc.conn.SetReadDeadline(time.Time{}) } + // This is the first request on the connection, + // so start the handler directly rather than going + // through scheduleHandler. + sc.curHandlers++ go sc.runHandler(rw, req, sc.handler.ServeHTTP) } @@ -2278,8 +2286,62 @@ func (sc *serverConn) newResponseWriter(st *stream, req *http.Request) *response return &responseWriter{rws: rws} } +type unstartedHandler struct { + streamID uint32 + rw *responseWriter + req *http.Request + handler func(http.ResponseWriter, *http.Request) +} + +// scheduleHandler starts a handler goroutine, +// or schedules one to start as soon as an existing handler finishes. +func (sc *serverConn) scheduleHandler(streamID uint32, rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) error { + sc.serveG.check() + maxHandlers := sc.advMaxStreams + if sc.curHandlers < maxHandlers { + sc.curHandlers++ + go sc.runHandler(rw, req, handler) + return nil + } + if len(sc.unstartedHandlers) > int(4*sc.advMaxStreams) { + return sc.countError("too_many_early_resets", ConnectionError(ErrCodeEnhanceYourCalm)) + } + sc.unstartedHandlers = append(sc.unstartedHandlers, unstartedHandler{ + streamID: streamID, + rw: rw, + req: req, + handler: handler, + }) + return nil +} + +func (sc *serverConn) handlerDone() { + sc.serveG.check() + sc.curHandlers-- + i := 0 + maxHandlers := sc.advMaxStreams + for ; i < len(sc.unstartedHandlers); i++ { + u := sc.unstartedHandlers[i] + if sc.streams[u.streamID] == nil { + // This stream was reset before its goroutine had a chance to start. + continue + } + if sc.curHandlers >= maxHandlers { + break + } + sc.curHandlers++ + go sc.runHandler(u.rw, u.req, u.handler) + sc.unstartedHandlers[i] = unstartedHandler{} // don't retain references + } + sc.unstartedHandlers = sc.unstartedHandlers[i:] + if len(sc.unstartedHandlers) == 0 { + sc.unstartedHandlers = nil + } +} + // Run on its own goroutine. func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { + defer sc.sendServeMsg(handlerDoneMsg) didPanic := true defer func() { rw.rws.stream.cancelCtx() diff --git a/vendor/modules.txt b/vendor/modules.txt index 2b728e5f34..0443012f80 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -915,7 +915,7 @@ golang.org/x/mod/internal/lazyregexp golang.org/x/mod/modfile golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.16.0 +# golang.org/x/net v0.17.0 ## explicit; go 1.17 golang.org/x/net/context golang.org/x/net/context/ctxhttp diff --git a/website/docs/r/actions_organization_permissions.html.markdown b/website/docs/r/actions_organization_permissions.html.markdown index e3a386028c..dffff27239 100644 --- a/website/docs/r/actions_organization_permissions.html.markdown +++ b/website/docs/r/actions_organization_permissions.html.markdown @@ -56,8 +56,8 @@ The `enabled_repositories_config` block supports the following: ## Import -This resource can be imported using the ID of the GitHub organization: +This resource can be imported using the name of the GitHub organization: ``` -$ terraform import github_actions_organization_permissions.test +$ terraform import github_actions_organization_permissions.test github_organization_name ``` diff --git a/website/docs/r/actions_repository_access_level.html.markdown b/website/docs/r/actions_repository_access_level.html.markdown index 03632e6589..c59ee8674b 100644 --- a/website/docs/r/actions_repository_access_level.html.markdown +++ b/website/docs/r/actions_repository_access_level.html.markdown @@ -36,5 +36,5 @@ The following arguments are supported: This resource can be imported using the name of the GitHub repository: ``` -$ terraform import github_actions_repository_access_level.test +$ terraform import github_actions_repository_access_level.test my-repository ``` diff --git a/website/docs/r/codespaces_secret.html.markdown b/website/docs/r/codespaces_secret.html.markdown index 933ceff784..4af0608ec7 100644 --- a/website/docs/r/codespaces_secret.html.markdown +++ b/website/docs/r/codespaces_secret.html.markdown @@ -58,8 +58,8 @@ The following arguments are supported: This resource can be imported using an ID made up of the `repository` and `secret_name`: ``` -$ terraform import github_codespaces_secret.example_secret / +$ terraform import github_codespaces_secret.example_secret example_repository/example_secret_name ``` NOTE: the implementation is limited in that it won't fetch the value of the -`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. \ No newline at end of file +`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/website/docs/r/dependabot_secret.html.markdown b/website/docs/r/dependabot_secret.html.markdown index 50f3d56edf..831d40d3c5 100644 --- a/website/docs/r/dependabot_secret.html.markdown +++ b/website/docs/r/dependabot_secret.html.markdown @@ -58,8 +58,8 @@ The following arguments are supported: This resource can be imported using an ID made up of the `repository` and `secret_name`: ``` -$ terraform import github_dependabot_secret.example_secret / +$ terraform import github_dependabot_secret.example_secret example_repository/example_secret ``` NOTE: the implementation is limited in that it won't fetch the value of the -`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. \ No newline at end of file +`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround.