Skip to content

Commit ceb1a51

Browse files
bugersredxnysredny buitrago
authored
Merging to release-5.6: TT-13130 updated version of gorpc library and prevent panic on start edge (#6629) (#6638)
### **User description** TT-13130 updated version of gorpc library and prevent panic on start edge (#6629) ### **User description** <details open> <summary><a href="https://tyktech.atlassian.net/browse/TT-13130" title="TT-13130" target="_blank">TT-13130</a></summary> <br /> <table> <tr> <th>Summary</th> <td>Tyk Cloud: Panic appears when a user tried to deploy GW before Control Plane is in deployed state </td> </tr> <tr> <th>Type</th> <td> <img alt="Bug" src="https://tyktech.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium" /> Bug </td> </tr> <tr> <th>Status</th> <td>In Dev</td> </tr> <tr> <th>Points</th> <td>N/A</td> </tr> <tr> <th>Labels</th> <td><a href="https://tyktech.atlassian.net/issues?jql=project%20%3D%20TT%20AND%20labels%20%3D%20Re_open%20ORDER%20BY%20created%20DESC" title="Re_open">Re_open</a></td> </tr> </table> </details> <!-- do not remove this marker as it will break jira-lint's functionality. added_by_jira_lint --> --- <!-- Provide a general summary of your changes in the Title above --> ## Description Moved the logic of waitgroup to be handled internally in the gorpc library. GW only have to wait until done() ## Related Issue TT-13130 ## Motivation and Context <!-- Why is this change required? What problem does it solve? --> ## How This Has Been Tested <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> ## Screenshots (if appropriate) ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ ### **PR Type** Bug fix, Enhancement ___ ### **Description** - Refactored the connection dialing logic in `rpc_client.go` to remove manual `sync.WaitGroup` handling, leveraging the internal wait group management provided by the `gorpc` library. - Updated the `gorpc` library to a newer version in `go.mod` and `go.sum`, ensuring compatibility and leveraging improvements. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>rpc_client.go</strong><dd><code>Refactor connection dialing wait group handling</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> rpc/rpc_client.go <li>Removed manual handling of <code>sync.WaitGroup</code> for connection dialing.<br> <li> Utilized <code>clientSingleton.ConnectionDialingWG</code> for managing connection <br>readiness.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6629/files#diff-3b88914c99bb9418e44e6389ce73579843562e8900730b380d7fff2e95c51033">+1/-7</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>go.mod</strong><dd><code>Update gorpc library version in go.mod</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> go.mod - Updated `gorpc` library version to latest. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6629/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>go.sum</strong><dd><code>Update go.sum for new gorpc version</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> go.sum - Updated checksums for new `gorpc` library version. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6629/files#diff-3295df7234525439d778f1b282d146a4f1ff6b415248aaac074e8042d9f42d63">+8/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: sredny buitrago <[email protected]> ___ ### **PR Type** Bug fix, Enhancement ___ ### **Description** - Refactored the connection dialing logic in `rpc_client.go` to remove manual `sync.WaitGroup` handling, leveraging the internal wait group management provided by the `gorpc` library. - Updated the `gorpc` library to a newer version in `go.mod` and `go.sum`, ensuring compatibility and leveraging improvements. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>rpc_client.go</strong><dd><code>Refactor connection dialing wait group handling</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> rpc/rpc_client.go <li>Removed manual handling of <code>sync.WaitGroup</code> for connection dialing.<br> <li> Utilized <code>clientSingleton.ConnectionDialingWG</code> for managing connection <br>readiness.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6638/files#diff-3b88914c99bb9418e44e6389ce73579843562e8900730b380d7fff2e95c51033">+1/-8</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Dependencies</strong></td><td><table> <tr> <td> <details> <summary><strong>go.mod</strong><dd><code>Update gorpc library version in go.mod</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> go.mod - Updated `gorpc` library version to the latest. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6638/files#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6">+1/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> <tr> <td> <details> <summary><strong>go.sum</strong><dd><code>Update go.sum for new gorpc version</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> go.sum - Updated checksums for new `gorpc` library version. </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6638/files#diff-3295df7234525439d778f1b282d146a4f1ff6b415248aaac074e8042d9f42d63">+2/-2</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: Sredny M <[email protected]> Co-authored-by: sredny buitrago <[email protected]>
1 parent 0540949 commit ceb1a51

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/TykTechnologies/drl v0.0.0-20231218155806-88e4363884a2
1111
github.com/TykTechnologies/goautosocket v0.0.0-20190430121222-97bfa5e7e481
1212
github.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990
13-
github.com/TykTechnologies/gorpc v0.0.0-20210624160652-fe65bda0ccb9
13+
github.com/TykTechnologies/gorpc v0.0.0-20241011145745-39f660923858
1414
github.com/TykTechnologies/goverify v0.0.0-20220808203004-1486f89e7708
1515
github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20240926103032-6eca9f4b5e30
1616
github.com/TykTechnologies/graphql-translator v0.0.0-20240319092712-4ba87e4c06ff

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ github.com/TykTechnologies/goautosocket v0.0.0-20190430121222-97bfa5e7e481 h1:fP
4545
github.com/TykTechnologies/goautosocket v0.0.0-20190430121222-97bfa5e7e481/go.mod h1:CtF8OunV123VfKa8Z9kKcIPHgcd67hSAwFMLlS7FvS4=
4646
github.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990 h1:CJRTgg13M3vJG9S7k7kpnvDRMGMywm5OsN6eUE8VwJE=
4747
github.com/TykTechnologies/gojsonschema v0.0.0-20170222154038-dcb3e4bb7990/go.mod h1:SQT0NBrY4/pMikBgwFIrWCjcHBxg015Y8is0kAnMtug=
48-
github.com/TykTechnologies/gorpc v0.0.0-20210624160652-fe65bda0ccb9 h1:fbxHiuw/244CQ4TEirzgL/CIMXDUx2szZn8cuuMlCy0=
49-
github.com/TykTechnologies/gorpc v0.0.0-20210624160652-fe65bda0ccb9/go.mod h1:v6v7Mlj08+EmEcXOfpuTxGt2qYU9yhqqtv4QF9Wf50E=
48+
github.com/TykTechnologies/gorpc v0.0.0-20241011145745-39f660923858 h1:W9bBHH3zj81xt15lnVWQfLAdAip46eL7Iyhr8yjp/0M=
49+
github.com/TykTechnologies/gorpc v0.0.0-20241011145745-39f660923858/go.mod h1:v6v7Mlj08+EmEcXOfpuTxGt2qYU9yhqqtv4QF9Wf50E=
5050
github.com/TykTechnologies/goverify v0.0.0-20220808203004-1486f89e7708 h1:cmXjlMzcexhc/Cg+QB/c2CPUVs1ux9xn6162qaf/LC4=
5151
github.com/TykTechnologies/goverify v0.0.0-20220808203004-1486f89e7708/go.mod h1:mkS8jKcz8otdfEXhJs1QQ/DKoIY1NFFsRPKS0RwQENI=
5252
github.com/TykTechnologies/graphql-go-tools v1.6.2-0.20240926103032-6eca9f4b5e30 h1:SxmD3nMD7AyhJGcOBG4QHwslMFvwLM0e3jH1enmWxZk=

rpc/rpc_client.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ func Connect(connConfig Config, suppressRegister bool, dispatcherFuncs map[strin
258258
clientSingleton.Conns = 5
259259
}
260260

261-
for i := 0; i < clientSingleton.Conns; i++ {
262-
connectionDialingWG.Add(1)
263-
}
264-
265261
clientSingleton.Dial = func(addr string) (conn net.Conn, err error) {
266262
dialer := &net.Dialer{
267263
Timeout: 10 * time.Second,
@@ -298,8 +294,6 @@ func Connect(connConfig Config, suppressRegister bool, dispatcherFuncs map[strin
298294
conn.Write([]byte("proto2"))
299295
conn.Write([]byte{byte(len(connID))})
300296
conn.Write([]byte(connID))
301-
// only mark as done is connection is established
302-
connectionDialingWG.Done()
303297

304298
return conn, nil
305299
}
@@ -311,9 +305,8 @@ func Connect(connConfig Config, suppressRegister bool, dispatcherFuncs map[strin
311305
if funcClientSingleton == nil {
312306
funcClientSingleton = dispatcher.NewFuncClient(clientSingleton)
313307
}
314-
315308
// wait until all the pool connections are dialed so we can call login
316-
connectionDialingWG.Wait()
309+
clientSingleton.ConnectionDialingWG.Wait()
317310
handleLogin()
318311
if !suppressRegister {
319312
register()

0 commit comments

Comments
 (0)