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

[Bug] Using Stream With generic and injvm not work #14546

Open
3 of 4 tasks
xixingya opened this issue Aug 19, 2024 · 11 comments
Open
3 of 4 tasks

[Bug] Using Stream With generic and injvm not work #14546

xixingya opened this issue Aug 19, 2024 · 11 comments
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage

Comments

@xixingya
Copy link
Contributor

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

3.2.*

Steps to reproduce this issue

https://github.com/xixingya/dubbo-demo/blob/master/dubbo-demo-spi/src/main/java/tech/xixing/dubbo/demo/stream/StreamProviderDemo.java
please see this code. which is copy from

https://cn.dubbo.apache.org/zh-cn/overview/mannual/java-sdk/reference-manual/protocol/triple/streaming/#%E5%AE%9E%E7%8E%B0%E7%B1%BB

What you expected to happen

the stream mode not working

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

@xixingya xixingya added component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage labels Aug 19, 2024
@xixingya
Copy link
Contributor Author

org.apache.dubbo.rpc.RpcException: java.lang.IllegalArgumentException: [Serialization Security] Serialized class tech.xixing.dubbo.demo.stream.StreamConsumerDemo$1 has not implement Serializable interface. Current mode is strict check, will disallow to deserialize it by default.
at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:129)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349)
at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:54)
at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$CopyOfFilterChainNode.invoke(FilterChainBuilder.java:349)
at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41)

at org.apache.dubbo.rpc.TriRpcStatus.asException(TriRpcStatus.java:213)
at org.apache.dubbo.rpc.protocol.tri.call.UnaryClientCallListener.onClose(UnaryClientCallListener.java:53)
at org.apache.dubbo.rpc.protocol.tri.call.TripleClientCall.onComplete(TripleClientCall.java:127)
at org.apache.dubbo.rpc.protocol.tri.stream.TripleClientStream$ClientTransportListener.finishProcess(TripleClientStream.java:243)
at org.apache.dubbo.rpc.protocol.tri.stream.TripleClientStream$ClientTransportListener.onTrailersReceived(TripleClientStream.java:328)
at org.apache.dubbo.rpc.protocol.tri.stream.TripleClientStream$ClientTransportListener.lambda$onHeader$1(TripleClientStream.java:431)
at org.apache.dubbo.common.threadpool.serial.SerializingExecutor.run(SerializingExecutor.java:105)

@xixingya
Copy link
Contributor Author

System.setProperty("dubbo.application.check-serializable", "false"); must set this properties works well,But using stream mode why I should set this properties

@JunJieLiu51520
Copy link
Contributor

because your stream consumer demo application invoke with generic,

image

but stream pattern can't either use generic or two params

image

you should remove reference.setGeneric("true"); than try again

@JunJieLiu51520
Copy link
Contributor

do you have some idea for your case ? i can implement that @xixingya

@xixingya
Copy link
Contributor Author

do you have some idea for your case ? i can implement that @xixingya

maybe streamObserver can exclude by Serializable check?

@xixingya xixingya changed the title [Bug] Using Stream With no protobuf not working [Bug] Using Stream With generic and injvm not work Aug 20, 2024
@AlbumenJ
Copy link
Member

StreamObserver is a special class and should not pass to Serialize checker

@JunJieLiu51520
Copy link
Contributor

JunJieLiu51520 commented Aug 21, 2024

StreamObserver is a special class and should not pass to Serialize checker

i guess that he wants to use generic invoke, and at the same time use StreamObserver(BI or S),such as following case:

    // generic invoke
    GenericService genericService = bootstrap.getCache().get(reference);

    StreamObserver<String> responseObserver = new StreamObserver<String>() {
        @Override
        public void onNext(String data) {
            
        }

        @Override
        public void onError(Throwable throwable) {

        }

        @Override
        public void onCompleted() {

        }
    };

    while (true) {
        try {
            Object genericInvokeResult =
                    genericService.$invoke("sayHello",
                            new String[] {String.class.getName(),StreamObserver.class.getName()},
                            new Object[] {param,responseObserver});
            System.out.println(genericInvokeResult);
            Thread.sleep(1000);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

is it ? @xixingya

@JunJieLiu51520
Copy link
Contributor

JunJieLiu51520 commented Aug 21, 2024

StreamObserver is a special class and should not pass to Serialize checker

yesterday, i try to rebuild GenericFilter and TripleInvoker to support it, but it's costly, need i support it ? @AlbumenJ

@AlbumenJ
Copy link
Member

You can try it

@shijilin0116
Copy link

shijilin0116 commented Aug 30, 2024

same promblem, looking forword to a solution~~

@flyhawk1010
Copy link

// generic invoke
GenericService genericService = bootstrap.getCache().get(reference);

StreamObserver<String> responseObserver = new StreamObserver<String>() {
    @Override
    public void onNext(String data) {
        
    }

    @Override
    public void onError(Throwable throwable) {

    }

    @Override
    public void onCompleted() {

    }
};

while (true) {
    try {
        Object genericInvokeResult =
                genericService.$invoke("sayHello",
                        new String[] {String.class.getName(),StreamObserver.class.getName()},
                        new Object[] {param,responseObserver});
        System.out.println(genericInvokeResult);
        Thread.sleep(1000);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

@JunJieLiu51520 I have this requirement, how can it be implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/need-triage Need maintainers to triage type/need-triage Need maintainers to triage
Projects
Status: Todo
Development

No branches or pull requests

5 participants