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

AsynMultiInterestUserProcessor在执行时被当做SyncUserProcessor #157

Closed
adisby opened this issue May 4, 2019 · 3 comments
Closed
Assignees
Milestone

Comments

@adisby
Copy link

adisby commented May 4, 2019

Describe the bug
由于AsynMultiInterestUserProcessor不是AsyncUserProcessor的子类,所以在RpcRequestProcessor.dispatchToUserProcessor()方法中被当做了SyncUserProcessor执行并同步等待,最终抛出异常

image

https://github.com/alipay/sofa-bolt/blob/531d1c0d872553d92fc55775565b3f7be8661afa/src/main/java/com/alipay/remoting/rpc/protocol/RpcRequestProcessor.java#L222

Expected behavior

AsynMultiInterestUserProcessor所注册的业务会异步处理

Actual behavior

AsynMultiInterestUserProcessor所注册的业务被当做SyncUserProcessor并且执行时抛出异常

Steps to reproduce

Minimal yet complete reproducer code (or GitHub URL to code)

Environment

  • SOFABolt version: 1.5.3

  • JVM version (e.g. java -version): 1.8.0_161

  • OS version (e.g. uname -a):

  • Maven version:

  • IDE version:

@dbl-x
Copy link
Contributor

dbl-x commented Jun 27, 2019

@adisby 能否提供一个复现以上问题的testcase

@dbl-x dbl-x self-assigned this Jun 27, 2019
@lollapalooza1989
Copy link
Contributor

I can replay it.
when I define a UserProcessor class
public class SimpleAsynMultiInterestUserProcessor extends AsynMultiInterestUserProcessor

when client call the server,the client side get the error stack:
com.alipay.remoting.rpc.exception.InvokeServerException: Server exception! Please check the server log, the address is 127.0.0.1:8999, id=1, ServerErrorMsg:null
Exception in thread "main" java.lang.AssertionError: RemotingException caught in oneway!
at com.alipay.remoting.rpc.RpcResponseResolver.preProcess(RpcResponseResolver.java:124) ~[classes/:?]
at org.junit.Assert.fail(Assert.java:88)
at com.alipay.remoting.rpc.RpcResponseResolver.resolveResponseObject(RpcResponseResolver.java:54) ~[classes/:?]
at com.alipay.remoting.demo.RpcClientDemoByMain.main(RpcClientDemoByMain.java:68)
at com.alipay.remoting.rpc.RpcRemoting.invokeSync(RpcRemoting.java:186) ~[classes/:?]
at com.alipay.remoting.rpc.RpcClientRemoting.invokeSync(RpcClientRemoting.java:64) ~[classes/:?]
at com.alipay.remoting.rpc.RpcRemoting.invokeSync(RpcRemoting.java:143) ~[classes/:?]
at com.alipay.remoting.rpc.RpcClient.invokeSync(RpcClient.java:198) ~[classes/:?]
at com.alipay.remoting.demo.RpcClientDemoByMain.main(RpcClientDemoByMain.java:63) [test-classes/:?]
Caused by: com.alipay.remoting.rpc.exception.RpcServerException: [Server]OriginErrorMsg: java.lang.UnsupportedOperationException: SYNC handle request is unsupported in AsynMultiInterestUserProcessor!. AdditionalErrorMsg: SYNC process rpc request failed in RpcRequestProcessor, id=1
at com.alipay.remoting.rpc.protocol.AsynMultiInterestUserProcessor.handleRequest(AsynMultiInterestUserProcessor.java:38) ~[classes/:?]
at com.alipay.remoting.rpc.protocol.RpcRequestProcessor.dispatchToUserProcessor(RpcRequestProcessor.java:240) ~[classes/:?]
at com.alipay.remoting.rpc.protocol.RpcRequestProcessor.doProcess(RpcRequestProcessor.java:145) ~[classes/:?]
at com.alipay.remoting.rpc.protocol.RpcRequestProcessor$ProcessTask.run(RpcRequestProcessor.java:366) ~[classes/:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_144]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_144]

it obviously a bug,I will try to fix it。

lollapalooza1989 pushed a commit to lollapalooza1989/sofa-bolt that referenced this issue Oct 10, 2019
lollapalooza1989 pushed a commit to lollapalooza1989/sofa-bolt that referenced this issue Oct 10, 2019
lollapalooza1989 pushed a commit to lollapalooza1989/sofa-bolt that referenced this issue Oct 10, 2019
@cytnju cytnju added this to the 1.5.7 release milestone Nov 27, 2019
@cytnju
Copy link
Contributor

cytnju commented Nov 27, 2019

@lollapalooza1989 welcome PR to help us fix it.

cytnju pushed a commit that referenced this issue Nov 29, 2019
* fix AbstractLifeCycle concurrency problem Fixes gh-163

* fix AbstractLifeCycle concurrency problem Fixes gh-163

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.
dbl-x pushed a commit that referenced this issue Dec 6, 2019
* fix AbstractLifeCycle concurrency problem Fixes gh-163 (#188)

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.

* support server random port constructor
cytnju added a commit to cytnju/sofa-bolt that referenced this issue Dec 10, 2019
cytnju added a commit to cytnju/sofa-bolt that referenced this issue Dec 10, 2019
@cytnju cytnju closed this as completed Dec 12, 2019
dbl-x pushed a commit that referenced this issue Dec 16, 2019
* (feat) add flush consolidation handler (#161)

* (feat) add flush consolidation option

* 1. upgrade version to 1.5.6 (#169)

2. fix NPE in channelInactive
3. handling reconnection situation with no connection binding with channel
4. du not scan connection pool associated with task that has not been don
5. add CONNECT_FAILED event type and print user event log

* Change org from alipay to sofatack. (#172)

* Update .travis.yml (#177)

* modify ReconnectManager to be compatible with version 1.5.x

* upgrade netty version to fix CNNVD-201909-1264 vulnerability (#189)

* 应该一个是序列化一个是反序列化 (#191)

fix unit test bug in class NormalStringCustomSerializer.

* (feat) Supports SSL for rpc server/client, #149 (#197)

* support server random port constructor. fix #196 (#199)

* fix AbstractLifeCycle concurrency problem Fixes gh-163 (#188)

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.

* support server random port constructor

* add rejection-processable InvokeCallback to provide flexible options when user executor rejected task. see #178(#178) (#202)

* complete tcp related config. see #171(#171) (#205)

* optimize DefaultConnectionManager contructor (#201)

* support availability check with life cycle. #195 (#204)

* support availability check with life cycle. #123(#123)

* complete unit test of life cycle available check

* fix CI error

* Fix/multi processor bug (#207)

* fix spell mistake and some test codes (#194)

* fix multi-processor bug

* fix PMD

* support user processor with life cycle interface fix #123 (#200)

* support user processor with life cycle interface

* make sure user processor startup if client/server has startup

* add state check before operate user processor in order to prevent from some unnecessary exception

* fix some codes (#208)

* change version
cytnju added a commit that referenced this issue Jul 6, 2020
* release 1.6.1 (#209)

* (feat) add flush consolidation handler (#161)

* (feat) add flush consolidation option

* 1. upgrade version to 1.5.6 (#169)

2. fix NPE in channelInactive
3. handling reconnection situation with no connection binding with channel
4. du not scan connection pool associated with task that has not been don
5. add CONNECT_FAILED event type and print user event log

* Change org from alipay to sofatack. (#172)

* Update .travis.yml (#177)

* modify ReconnectManager to be compatible with version 1.5.x

* upgrade netty version to fix CNNVD-201909-1264 vulnerability (#189)

* 应该一个是序列化一个是反序列化 (#191)

fix unit test bug in class NormalStringCustomSerializer.

* (feat) Supports SSL for rpc server/client, #149 (#197)

* support server random port constructor. fix #196 (#199)

* fix AbstractLifeCycle concurrency problem Fixes gh-163 (#188)

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.

* support server random port constructor

* add rejection-processable InvokeCallback to provide flexible options when user executor rejected task. see #178(#178) (#202)

* complete tcp related config. see #171(#171) (#205)

* optimize DefaultConnectionManager contructor (#201)

* support availability check with life cycle. #195 (#204)

* support availability check with life cycle. #123(#123)

* complete unit test of life cycle available check

* fix CI error

* Fix/multi processor bug (#207)

* fix spell mistake and some test codes (#194)

* fix multi-processor bug

* fix PMD

* support user processor with life cycle interface fix #123 (#200)

* support user processor with life cycle interface

* make sure user processor startup if client/server has startup

* add state check before operate user processor in order to prevent from some unnecessary exception

* fix some codes (#208)

* change version

* update travis ci config

Co-authored-by: cytnju <muyun.cyt@antfin.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

No branches or pull requests

4 participants