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

Add Mock Server classes for seata-all #5343

Closed
1 task done
linghengqian opened this issue Feb 15, 2023 · 17 comments
Closed
1 task done

Add Mock Server classes for seata-all #5343

linghengqian opened this issue Feb 15, 2023 · 17 comments

Comments

@linghengqian
Copy link
Member

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

[ERROR] 2023-02-15 12:44:06.866 [main] i.s.c.r.netty.AbstractNettyRemoting - wait response error:null ,cost: 30001 ms,ip:/127.0.0.1:8891,request:timeout=30000,transactionName=default

io.seata.core.exception.TmTransactionException: RPC timeout

	at io.seata.tm.DefaultTransactionManager.syncCall(DefaultTransactionManager.java:97)
	at io.seata.tm.DefaultTransactionManager.begin(DefaultTransactionManager.java:53)
	at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:114)
	at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:95)
	at com.lingh.SeataATShardingSphereTransactionManager.begin(SeataATShardingSphereTransactionManager.java:85)
	at com.lingh.SeataATShardingSphereTransactionManagerTest.assertBeginTimeout(SeataATShardingSphereTransactionManagerTest.java:96)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.util.concurrent.TimeoutException: null ,cost: 30001 ms
	at io.seata.core.protocol.MessageFuture.get(MessageFuture.java:65)
	at io.seata.core.rpc.netty.AbstractNettyRemoting.sendSync(AbstractNettyRemoting.java:199)
	at io.seata.core.rpc.netty.AbstractNettyRemotingClient.sendSyncRequest(AbstractNettyRemotingClient.java:187)
	at io.seata.tm.DefaultTransactionManager.syncCall(DefaultTransactionManager.java:95)
	... 36 more

Ⅲ. Describe what you expected to happen

  • All unit tests should be fine.

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. Execute the following commands for comparison in Ubuntu 22.04.
sudo apt install unzip zip curl sed -y
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 22.3.1.r17-grl
sdk use java 22.3.1.r17-grl
sdk install maven

git clone git@github.com:linghengqian/mock-seata-sever-test.git
cd ./mock-seata-sever-test/

cd ./mock-seata-v142/
mvn clean test

cd ..
cd ./mock-seata-v161/
mvn clean test

Ⅴ. Anything else we need to know?

  • I'm not sure if there's anything that needs to be changed as I don't see a particularly prominent PR for the Seata 1.5.1 milestone. In fact, this part of the unit test of ShardingSphere has failed since Seata 1.5.1. The unit tests for Seata 1.4.2 are fine, but the unit tests for Seata 1.6.1 are failing.

Ⅵ. Environment:

  • JDK version : 17
  • Seata version: 1.6.1
  • OS : Ubuntu
  • Others: null
@funky-eyes
Copy link
Contributor

The above information can not see the problem, because 1.4.2 to 1.6 did not make major adjustments to the rpc module, and your error is rpc timeout, you should check whether your network can connect to tc

@linghengqian
Copy link
Member Author

@a364176773 I would like to know what information I can refer to? I didn't see any special configuration for RPC in the https://github.com/linghengqian/mock-seata-sever-test I provided. I just mocked a Seata Server using netty classes, did any big changes happen between Seata 1.4.2 and Seata 1.5.1?

@funky-eyes
Copy link
Contributor

No, this can be proven by running a sample from 1.4.2 to 1.5.1 without mock

@linghengqian
Copy link
Member Author

No, this can be proven by running a sample from 1.4.2 to 1.5.1 without mock

@slievrly
Copy link
Member

@linghengqian I have repeated this question, and I will give you the conclusion later.

@slievrly
Copy link
Member

@linghengqian In the past TM and RM messages were sent to TC by default using merged MergedWarpMessage messages.In version 1.6.x, TM messages are no longer merged by default for performance reasons, including: GlobalBeginRequest, GlobalCommitRequest, and GlobalRollbackRequest.
Of course, there is another way to solve the problem without changing the code at all, by adding a single line of configuration.
seata.transport.enable-tm-client-batch-send-request=true

@linghengqian
Copy link
Member Author

  • @slievrly Thank you very much for your reply! Can I close the current issue now?

@slievrly
Copy link
Member

@linghengqian Through this question, I realized that we needed to maintain our own mock-server to ensure version compatibility. I've had a quick look at the mock-server code you've written, and I think you can contribute an original version of mock-server if you want. Are you interested ?

@slievrly
Copy link
Member

@linghengqian I noticed that you are doing something related to GraalVM, and Seata is also doing it. We can communicate with each other about the progress. #5234

@linghengqian
Copy link
Member Author

@linghengqian Through this question, I realized that we needed to maintain our own mock-server to ensure version compatibility. I've had a quick look at the mock-server code you've written, and I think you can contribute an original version of mock-server if you want. Are you interested ?

  • This MockServer class comes entirely from Apache ShardingSphere's unit tests, so I don't really feel like I have experience perfecting this class. If possible, I would like it to be done by other friends.

@linghengqian
Copy link
Member Author

@linghengqian I noticed that you are doing something related to GraalVM, and Seata is also doing it. We can communicate with each other about the progress. #5234

@slievrly
Copy link
Member

@linghengqian Through this question, I realized that we needed to maintain our own mock-server to ensure version compatibility. I've had a quick look at the mock-server code you've written, and I think you can contribute an original version of mock-server if you want. Are you interested ?

  • This MockServer class comes entirely from Apache ShardingSphere's unit tests, so I don't really feel like I have experience perfecting this class. If possible, I would like it to be done by other friends.

OK, anyone willing to contribute is welcome.

@slievrly
Copy link
Member

slievrly commented Feb 16, 2023

@wangliang181230 Pls take a look at suggestions for using metadata configuration and Spring code.

@wangliang181230
Copy link
Contributor

@wangliang181230 Pls take a look at suggestions for using metadata configuration and Spring code.

@slievrly OK.

@wangliang181230
Copy link
Contributor

@linghengqian #5234 has been put on hold for the time, because of some other PRs merged, resulting in some code incompatibilities.

At present, I am making some changes on the native branch of seata.

On the native branch, I have changed most of the reachability-metadata to use the <feature>-config.json, except for the optional components, and I have passed the local test.
Later, I will release 1.7.0-native-rc1 to the OSSRH for intergrated-test with SCA.
After the intergrated-test is passed, I will submit a PR to https://github.com/oracle/graalvm-reachability-metadata.

At present, seata-server is not compatible with springroot3 and native-image, so CI of nativeTest cannot be added temporarily.

@linghengqian linghengqian changed the title Can't mock Seata Server normally under Seata 1.6.1 Add Mock Server class for seata-all Apr 1, 2023
@linghengqian linghengqian changed the title Add Mock Server class for seata-all Add Mock Server classes for seata-all Apr 1, 2023
@linghengqian
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants