Skip to content
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

up go 1.22.3 #4861

Merged
merged 1 commit into from
May 20, 2024
Merged

up go 1.22.3 #4861

merged 1 commit into from
May 20, 2024

Conversation

pfi79
Copy link
Contributor

@pfi79 pfi79 commented May 16, 2024

The following changes have been made:

@pfi79 pfi79 requested review from a team as code owners May 16, 2024 12:32
Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
Copy link
Contributor

@denyeart denyeart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the 1.22 update, quite timely!

@@ -37,6 +37,8 @@ jobs:
name: Unit Tests
needs: basic-checks
runs-on: ${{ github.repository == 'hyperledger/fabric' && 'fabric-ubuntu-20.04' || 'ubuntu-20.04' }}
env:
GOEXPERIMENT: nocoverageredesign
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly breaks if we don't add GOEXPERIMENT=nocoverageredesign ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

golang/go#67427

--- FAIL: TestEndorsementPlugin (3.03s)
panic: Error opening plugin at path /var/folders/6v/kmxqr0yn61588pbz646cfdyc0000gq/T/TestEndorsementPlugin4080854438/001/endorsementplugin.so: plugin.Open("/var/folders/6v/kmxqr0yn61588pbz646cfdyc0000gq/T/TestEndorsementPlugin4080854438/001/endorsementplugin"): plugin was built with a different version of package github.com/hyperledger/fabric/core/handlers/endorsement/api [recovered]
        panic: Error opening plugin at path /var/folders/6v/kmxqr0yn61588pbz646cfdyc0000gq/T/TestEndorsementPlugin4080854438/001/endorsementplugin.so: plugin.Open("/var/folders/6v/kmxqr0yn61588pbz646cfdyc0000gq/T/TestEndorsementPlugin4080854438/001/endorsementplugin"): plugin was built with a different version of package github.com/hyperledger/fabric/core/handlers/endorsement/api

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go test -v -cover github.com/hyperledger/fabric/core/handlers/endorsement/api github.com/hyperledger/fabric/core/handlers/library

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from github action:

2024-05-15 16:03:16.284 UTC 0001 PANI [core.handlers] loadPlugin -> Error opening plugin at path /tmp/TestEndorsementPlugin3801377298/001/endorsementplugin.so: plugin.Open("/tmp/TestEndorsementPlugin3801377298/001/endorsementplugin"): plugin was built with a different version of package github.com/hyperledger/fabric/core/handlers/endorsement/api
--- FAIL: TestEndorsementPlugin (2.23s)
panic: Error opening plugin at path /tmp/TestEndorsementPlugin3801377298/001/endorsementplugin.so: plugin.Open("/tmp/TestEndorsementPlugin3801377298/001/endorsementplugin"): plugin was built with a different version of package github.com/hyperledger/fabric/core/handlers/endorsement/api [recovered]
	panic: Error opening plugin at path /tmp/TestEndorsementPlugin3801377298/001/endorsementplugin.so: plugin.Open("/tmp/TestEndorsementPlugin3801377298/001/endorsementplugin"): plugin was built with a different version of package github.com/hyperledger/fabric/core/handlers/endorsement/api

goroutine 34 [running]:
testing.tRunner.func1.2({0x19efbc0, 0xc00041a5a0})
	/opt/hostedtoolcache/go/1.22.3/x64/src/testing/testing.go:1631 +0x3f7
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.22.3/x64/src/testing/testing.go:1634 +0x6b6
panic({0x19efbc0?, 0xc00041a5a0?})
	/opt/hostedtoolcache/go/1.22.3/x64/src/runtime/panic.go:770 +0x132
go.uber.org/zap/zapcore.CheckWriteAction.OnWrite(0x2, 0xc000166820, {0x4a?, 0xc000264300?, 0x17b?})
	/home/runner/work/fabric/fabric/vendor/go.uber.org/zap/zapcore/entry.go:196 +0x9f
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc000166820, {0x0, 0x0, 0x0})
	/home/runner/work/fabric/fabric/vendor/go.uber.org/zap/zapcore/entry.go:262 +0x3ad
go.uber.org/zap.(*SugaredLogger).log(0xc0002b8e70, 0x4, {0xc000276360, 0x117}, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0})
	/home/runner/work/fabric/fabric/vendor/go.uber.org/zap/sugar.go:316 +0x130
go.uber.org/zap.(*SugaredLogger).Panicf(...)
	/home/runner/work/fabric/fabric/vendor/go.uber.org/zap/sugar.go:202
github.com/hyperledger/fabric-lib-go/common/flogging.(*FabricLogger).Panicf(...)
	/home/runner/work/fabric/fabric/vendor/github.com/hyperledger/fabric-lib-go/common/flogging/zap.go:74
github.com/hyperledger/fabric/core/handlers/library.(*registry).loadPlugin(0xc000443e18, {0xc00003a840, 0x3d}, 0x2, {0xc000443e98, 0x1, 0x1})
	/home/runner/work/fabric/fabric/core/handlers/library/plugin.go:30 +0x3a9
github.com/hyperledger/fabric/core/handlers/library.TestEndorsementPlugin(0xc00037d040)
	/home/runner/work/fabric/fabric/core/handlers/library/registry_plugin_test.go:100 +0x1e7
testing.tRunner(0xc00037d040, 0x1c[215](https://github.com/pfi79/fabric/actions/runs/9098906093/job/25010318274#step:5:216)88)
	/opt/hostedtoolcache/go/1.22.3/x64/src/testing/testing.go:1689 +0x21f
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.22.3/x64/src/testing/testing.go:1742 +0x826
FAIL	github.com/hyperledger/fabric/core/handlers/library	31.645s

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to resolve this test failure without the workaround? Or is that what you are asking in the go community? I wouldn't want to use a workaround which may go away in the next release. But maybe you are suggesting this is a temporary Go issue that will get resolved by next release?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to resolve this test failure without the workaround? Or is that what you are asking in the go community? I wouldn't want to use a workaround which may go away in the next release. But maybe you are suggesting this is a temporary Go issue that will get resolved by next release?

Yes I have tried various ways to solve the problem, assuming the error is somewhere in our fabric. But so far my conclusion is that the error is in go.

I went through all the questions in the go community on this topic and realized the following:

  • they redesigned the cover tool.
  • There are a lot of comments on the new cover. The developers themselves recognize this and are waiting for fixes.
  • so they introduced the GOEXPERIMENT=nocoverageredesign flag.

What happens next:

  • some fixes to the new cover will be made. I don't know to what extent.
  • At the end GOEXPERIMENT=nocoverageredesign will be canceled.

I hope that by that time in new go releases our problem will be solved.
I highlighted with my question that their new cover created a problem for us. I will wait and hope that the developers will see and respond to my question. Maybe they will offer some other alternative solution.

@C0rWin
Copy link
Contributor

C0rWin commented May 16, 2024

  • The creators of go overmuch with the change of cover work. So far I have turned on the old flag of cover operation - GOEXPERIMENT=nocoverageredesign. I will open a question in the go community. Most likely in the next release of go it will be necessary to remove this flag.

I do not think this is should be a fix and need to have better understanding of the root cause for the unit tests in failure.

@pfi79
Copy link
Contributor Author

pfi79 commented May 17, 2024

  • The creators of go overmuch with the change of cover work. So far I have turned on the old flag of cover operation - GOEXPERIMENT=nocoverageredesign. I will open a question in the go community. Most likely in the next release of go it will be necessary to remove this flag.

I do not think this is should be a fix and need to have better understanding of the root cause for the unit tests in failure.

All right. I got it. I'll find a better explanation for why they're like this.

@pfi79
Copy link
Contributor Author

pfi79 commented May 17, 2024

@C0rWin @denyeart

I was able to simulate the error.
The error is definitely not in fabric, it's in go. At a certain stage the test has an extra file covervars.go. Because of this, the test and plugin have different versions of the same package.

I'll pass it all on to the go developers from here on out.

Here's my example of the error appearing.
https://github.com/pfi79/go-test-cover-error

@denyeart
Copy link
Contributor

@C0rWin @denyeart

I was able to simulate the error. The error is definitely not in fabric, it's in go. At a certain stage the test has an extra file covervars.go. Because of this, the test and plugin have different versions of the same package.

I'll pass it all on to the go developers from here on out.

Here's my example of the error appearing. https://github.com/pfi79/go-test-cover-error

Ok, thanks for investigating and opening the dialog with the Go team. Please add a link to that conversation here. Let's keep this PR on hold for now, perhaps Go team will offer another solution. Alternatively, if they agree to work on a fix we could potentially use the GOEXPERIMENT=nocoverageredesign workaround until the fix is available.

@pfi79
Copy link
Contributor Author

pfi79 commented May 17, 2024

@denyeart @C0rWin I got an answer.

The error is no longer reproduced in version 1.23.

There are 2 variants of action:

  • Wait for go version 1.23 and try it already.
  • Now accept pr with GOEXPERIMENT=nocoverageredesign. When go 1.23 appears, check and if successful, remove GOEXPERIMENT=nocoverageredesign.

@pfi79
Copy link
Contributor Author

pfi79 commented May 17, 2024

I'll add more details

  1. go developers started to change cover to allow to take into account those packages that do not have test files, but functions are called from them when running tests.

Further implementation problems:

  1. when forming a test plan, when several packages are passed there, their compilation cache is common for all tests.
  2. core/handlers/endorsement/api package as a separate package for testing is processed in a special way and some covervars.go file is added to its cache.
  3. our test from core/handlers/library depends on the core/handlers/endorsement/api package and with the cover.go file compiles it into the body of the executable.
  4. Next, the test sends a command to build a plugin. The plugin also depends on core/handlers/endorsement/api, but it is built independently of the test. Therefore, it does not know anything about the covervars.go file.
  5. And we try to open the plugin, but the core/handlers/endorsement/api package is really different in the test and in the plugin

@denyeart
Copy link
Contributor

Since it appears to be resolved in upcoming Go 1.23, I'd be willing to live with the workaround GOEXPERIMENT=nocoverageredesign for the duration of Go 1.22. Let's see if others agree...

@C0rWin
Copy link
Contributor

C0rWin commented May 19, 2024

Since it appears to be resolved in upcoming Go 1.23, I'd be willing to live with the workaround GOEXPERIMENT=nocoverageredesign for the duration of Go 1.22. Let's see if others agree...

Well, this is not really a production code matter, so I think it's fine. However, IMO, we can just skip 1.22 and wait for 1.23 since I do not think there is something urgent that might require an immediate update to 1.22.

@denyeart
Copy link
Contributor

Since it appears to be resolved in upcoming Go 1.23, I'd be willing to live with the workaround GOEXPERIMENT=nocoverageredesign for the duration of Go 1.22. Let's see if others agree...

Well, this is not really a production code matter, so I think it's fine. However, IMO, we can just skip 1.22 and wait for 1.23 since I do not think there is something urgent that might require an immediate update to 1.22.

I do like to step through every Go release... if some problem shows up it is easier to pinpoint the issue by looking at that version's Go release notes. There will also be a growing list of CVEs on Go 1.21 so I'm motivated to get to 1.22 soon and backport for a v2.5.8 release.

Let's see if there are any other comments in the next day, otherwise I'll plan to approve and merge.

Copy link
Contributor

@denyeart denyeart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no other comments, I'll go ahead and merge, thank you @pfi79 !

@denyeart denyeart merged commit 88c4134 into hyperledger:main May 20, 2024
14 of 15 checks passed
@pfi79 pfi79 deleted the up-go-1.22 branch May 20, 2024 21:10
denyeart added a commit to denyeart/fabric that referenced this pull request May 21, 2024
Bump Go to 1.22.3.
See details in hyperledger#4861.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
C0rWin pushed a commit that referenced this pull request May 21, 2024
Bump Go to 1.22.3.
See details in #4861.

Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants