DUBBO-7349 Fix the build on Linux ARM64 CPU architecture#7408
DUBBO-7349 Fix the build on Linux ARM64 CPU architecture#7408AlbumenJ merged 5 commits intoapache:masterfrom martin-g:fix-build-and-tests-on-arm64
Conversation
| <groupId>com.github.kstyrc</groupId> | ||
| <groupId>com.github.codemonstur</groupId> | ||
| <artifactId>embedded-redis</artifactId> | ||
| <scope>test</scope> |
There was a problem hiding this comment.
because it is already set at https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-dependencies-bom/pom.xml#L628 in the dependencyManagement section
There was a problem hiding this comment.
this way it is in sync with
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-registry/dubbo-registry-multiple/pom.xml#L55-L58
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-registry/dubbo-registry-redis/pom.xml#L47-L50
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-rpc/dubbo-rpc-redis/pom.xml#L42-L45
There was a problem hiding this comment.
Rather than remove <scope>test</scope>, add <scope>test</scope> will be better I think.
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-registry/dubbo-registry-multiple/pom.xml#L55-L58
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-registry/dubbo-registry-redis/pom.xml#L47-L50
- https://github.com/martin-g/dubbo/blob/fix-build-and-tests-on-arm64/dubbo-rpc/dubbo-rpc-redis/pom.xml#L42-L45
There was a problem hiding this comment.
Done!
Also rebased to latest master
dubbo-dependencies-bom/pom.xml
Outdated
| <version>${grpc.version}</version> | ||
| </dependency> | ||
| <!-- Groovy, for Embedded Consul. Could be removed once embedded-consul:2.2.1 is released | ||
| See https://github.com/pszymczyk/embedded-consul/pull/114 |
There was a problem hiding this comment.
You might wait a little bit with merging that PR. We plan to release 2.2.1 "soon".
There was a problem hiding this comment.
I really hope this PR can be merged ASAP, so this issue #7421 can be fixed.
There was a problem hiding this comment.
@pinxiong I am afraid that this PR won't fix the issue for Mac ARM64. Currently embedded-redis:0.9.0 supports only Linux ARM64. We used Docker+QEMU to build the Linux ARM64 binary - https://github.com/codemonstur/embedded-redis/tree/master/src/main/binaries. I am not sure whether there is a similar way to emulate Mac ARM64.
I am not sure whether @codemonstur has access to Mac M1 machine to build the binary.
There was a problem hiding this comment.
Thank you for letting me know! If somebody need my help for testing in Mac M1 machine, I'm very happy to do it. @martin-g @codemonstur
There was a problem hiding this comment.
@pinxiong With PR codemonstur/embedded-redis#3 I've tried to convince @codemonstur to add support for a special system property to ExecutableProvider to set the path to the redis-server binary but he didn't like this approach.
If this PR was merged then Dubbo/pom.xml could add a profile for Mac ARM64 and export this property in Maven Surefire argline. Maybe @codemonstur will reconsider it.
BTW once you pass the issue with embedded-redis I expect that you will face similar issue with embedded-consul.
There was a problem hiding this comment.
BTW once you pass the issue with embedded-redis I expect that you will face similar issue with embedded-consul.
@martin-g Thanks for your reminder.
There was a problem hiding this comment.
@martin-g I have passed the issue with embedded-redis when I disabled all test cases in RedisMetadataReportTest. Fortunately, I didn't face similar issue with embedded-consul.
There was a problem hiding this comment.
You might wait a little bit with merging that PR. We plan to release 2.2.1 "soon".
@szpak Any ETA ?
There was a problem hiding this comment.
@martin-g ETA: -15 minutes :-)
https://github.com/pszymczyk/embedded-consul/releases/tag/release%2F2.2.1
| @@ -60,15 +60,15 @@ public void constructor(TestInfo testInfo) throws IOException { | |||
| String methodName = testInfo.getTestMethod().get().getName(); | |||
There was a problem hiding this comment.
Below this line you would put
ExecutableProvider provider = () -> new File(System.getProperty("my.custom.property"));
| if ("testAuthRedisMetadata".equals(methodName) || ("testWrongAuthRedisMetadata".equals(methodName))) { | ||
| String password = "チェリー"; | ||
| RedisServerBuilder builder = RedisServer.builder().port(redisPort).setting("requirepass " + password); | ||
| RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort).setting("requirepass " + password); |
There was a problem hiding this comment.
Add .redisExecProvider(provider) here.
| registryUrl = URL.valueOf("redis://username:" + password + "@localhost:" + redisPort); | ||
| } else { | ||
| RedisServerBuilder builder = RedisServer.builder().port(redisPort); | ||
| RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort); |
There was a problem hiding this comment.
And here add .redisExecProvider(provider) as well.
| String password = "チェリー"; | ||
| RedisServerBuilder builder = RedisServer.builder().port(redisPort).setting("requirepass " + password); | ||
| RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort).setting("requirepass " + password); | ||
| if (SystemUtils.IS_OS_WINDOWS) { |
There was a problem hiding this comment.
Yuck. I'm going to add a .settingIf(boolean, String) so that you can use the builder as it was intended.
There was a problem hiding this comment.
@codemonstur Thanks for your help. I hope everything will be the same as you expected.
There was a problem hiding this comment.
@codemonstur I see that your update has been merged in master branch. However, I still cannot work well when I run RedisMetadataReportTest.
If we want to fix issue #7421 , we need to upgrade the redis from 2.8.19 to 6.0.10 or 6.2 RC2 (see #8062, #8195) in embedded-redis
We can get some more details from redis releases 6.0.10
Bug fixes:
- Fix setproctitle related crashes. (#8150, #8088)
Caused various crashes on startup, mainly on Apple M1 chips or under instrumentation
I really hope you can commit an new PR to solve this problem (#7421).
Maybe @martin-g can persuade @codemonstur to do it.
There was a problem hiding this comment.
I was going to suggest to create an issue at https://github.com/codemonstur/embedded-redis and discuss there but "Issues" are not enabled there, only "Pull Requests".
@pinxiong As I said earlier - many of us do not have access to Mac ARM64 hardware and it is impossible for us to improve for it. But @codemonstur added APIs to use custom ExecutableProvider that can run any binary you tell it to.
For example, you can introduce a new Maven profile that is activated only for os=mac + arch=aarch64 and sets system property embedded.redis.executable (see https://github.com/codemonstur/embedded-redis/blob/master/src/main/java/redis/embedded/core/ExecutableProvider.java#L18). The value should be an absolute path to the Redis 6.x binary for Mac ARM64. Then in the tests code check whether this system property is non-null and use ExecutableProvider.newSystemPropertyProvider() instead of the default one.
There was a problem hiding this comment.
@pinxiong the current approach that I think will work for you is as @martin-g described. I just enabled issues in https://github.com/codemonstur/embedded-redis. So if you guys want to discuss any it is now possible.
There was a problem hiding this comment.
@martin-g @codemonstur I have opened an issue #6 where we can discuss.
|
@martin-g great! Please merge master branch to solve confilcting file. |
|
Done! |
Codecov Report
@@ Coverage Diff @@
## master #7408 +/- ##
============================================
- Coverage 59.24% 59.19% -0.06%
+ Complexity 503 501 -2
============================================
Files 1076 1076
Lines 43407 43406 -1
Branches 6337 6337
============================================
- Hits 25716 25693 -23
- Misses 14852 14877 +25
+ Partials 2839 2836 -3 Continue to review full report at Codecov.
|
Update embedded-redis and embedded-consul to newer versions which have native binaries for aarch64 Re-introduce TravisCI as a build tool only for ARM64. It will run as a cron job every night
… section Inline the version so that it is not forgotten to be removed when the dependency is removed with the upgrade to embedded-consul:2.2.1 See pszymczyk/embedded-consul#114
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7408 +/- ##
============================================
- Coverage 59.24% 59.19% -0.06%
+ Complexity 503 501 -2
============================================
Files 1076 1076
Lines 43407 43406 -1
Branches 6337 6337
============================================
- Hits 25716 25693 -23
- Misses 14852 14877 +25
+ Partials 2839 2836 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What is the purpose of the change
Apache Dubbo is a Java application and thus should work fine on any architecture supported by the Java Virtual Machine.
But Dubbo depends on some libraries which use native binaries that do not have aarch64 version, for example embedded-redis and embedded-consul.
This PR updates those dependencies with newer versions which added support for ARM64 architecture!
Verifying this change
The PR re-introduces TravisCI as a build tool to build and tests
masterbranch every night.This has been discussed at https://lists.apache.org/thread.html/r2742c51066b55787571417ed74843cd9607ba8202566ddd807f9bdab%40%3Cdev.dubbo.apache.org%3E
Someone from Dubbo team will have to setup the Cron job at TravisCI UI !