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

RSocket Protoc 0.2.19 generates invalid protobuf code for rsocket-java 1.0.1 #68

Open
ghost opened this issue Jul 3, 2020 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 3, 2020

Expected Behavior

When running the generateProto task using the latest version of io.rsocket.rpc:rsocket-rpc-core/io.rsocket.rpc:rsocket-rpc-protobuf (0.2.19) and the latest version of io.rsocket:rsocket-core (1.0.1), the generated code can be compiled without any issues.

Actual Behavior

When running the generateProto task using the latest version of io.rsocket.rpc:rsocket-rpc-core/io.rsocket.rpc:rsocket-rpc-protobuf (0.2.19) and the latest version of io.rsocket:rsocket-core (1.0.1), I get an error inside generated-sources/main/rsocketRpc/com/rsocket/rpc/Blocking...Service.java:

Cannot resolve symbol 'SwitchTransformFlux'

This is because of the following snippet:

  @java.lang.Override
  public reactor.core.publisher.Flux<io.rsocket.Payload> requestChannel(org.reactivestreams.Publisher<io.rsocket.Payload> payloads) {
    return new io.rsocket.internal.SwitchTransformFlux<io.rsocket.Payload, io.rsocket.Payload>(payloads, new java.util.function.BiFunction<io.rsocket.Payload, reactor.core.publisher.Flux<io.rsocket.Payload>, org.reactivestreams.Publisher<? extends io.rsocket.Payload>>() {
      @java.lang.Override
      public org.reactivestreams.Publisher<io.rsocket.Payload> apply(io.rsocket.Payload payload, reactor.core.publisher.Flux<io.rsocket.Payload> publisher) {
        return requestChannel(payload, publisher);
      }
    });
  }

It seems to me like the SwitchTransformFlux class got removed/replaced in version 1.0.0 of rsocket-java. When I downgrade to 0.12.1, the error is gone. None the less, this is an issue as a lot of dependencies (e.g. the spring boot rsocket starter lib) already use v1.X and therefore cannot produce valid code.

Steps to Reproduce

  1. Import io.rsocket:rsocket-core:1.0.1
  2. Import io.rsocket.rpc:rsocket-rpc-core:0.2.19
  3. Import io.rsocket.rpc:rsocket-rpc-protobuf:0.2.19
  4. Create a .proto file with a service that uses a channel
service SomeService {
  rpc channel(stream SomeRequest) returns (stream SomeResponse) {}
}
  1. Generate the protobuf classes (e.g. ./gradlew generateProto)
  2. Try to compile the blocking server implementation (generated-sources/main/rsocketRpc/com/rsocket/rpc/BlockingSomeServiceServer.java)

Should fail with the exception mentioned above.

Possible Solution

Either reintroduce SwitchTransformFlux or change the rsocket protoc to not use it anymore.

Your Environment

  • io.rsocket:rsocket-core:1.0.1
  • io.rsocket.rpc:rsocket-rpc-core:0.2.19
  • io.rsocket.rpc:rsocket-rpc-protobuf:0.2.19
  • com.google.protobuf:protoc:3.12.1
  • com.google.protobuf:protobuf-java:3.12.1
@OlegDokuka OlegDokuka transferred this issue from rsocket/rsocket-java Jul 3, 2020
@ghost
Copy link
Author

ghost commented Jul 3, 2020

Ooops, of course you're right @OlegDokuka :) Thanks for transferring!

@ghost
Copy link
Author

ghost commented Jul 3, 2020

Also, seems like this already got mentioned in #65 😬

@eksd
Copy link

eksd commented Sep 28, 2020

@OlegDokuka , hi, is it possible to make a fix of this bug in the nearest future? Our work depends a lot on rsocket and we cannot upgrade it without this fix. Thanks.

@OlegDokuka
Copy link
Member

@eksd I will take a look at that today.

Cheers,
Oleh

@eksd
Copy link

eksd commented Oct 9, 2020

@OlegDokuka , did you have a chance to take a look at that bug?

Thanks.

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

2 participants