Skip to content

Commit 59ab1b8

Browse files
committed
Ensure metadata is released
1 parent 9c055c6 commit 59ab1b8

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
group=io.rsocket.rpc
2-
version=0.2.1
2+
version=0.2.2

gradle/java.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ dependencies {
8383
testCompile 'io.projectreactor:reactor-test:3.1.9.RELEASE'
8484
testCompile 'com.google.protobuf:protobuf-java:3.6.1'
8585
testCompile 'org.hdrhistogram:HdrHistogram:2.1.10'
86-
testCompile 'org.apache.logging.log4j:log4j-api:2.8.2'
87-
testCompile 'org.apache.logging.log4j:log4j-core:2.8.2'
88-
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:2.8.2'
89-
testCompile 'io.rsocket:rsocket-transport-netty:0.11.6'
90-
testCompile 'io.rsocket:rsocket-transport-local:0.11.6'
86+
testCompile 'org.apache.logging.log4j:log4j-api:2.9.0'
87+
testCompile 'org.apache.logging.log4j:log4j-core:2.9.0'
88+
testCompile 'org.apache.logging.log4j:log4j-slf4j-impl:2.9.0'
89+
testCompile 'io.rsocket:rsocket-transport-netty:0.11.7'
90+
testCompile 'io.rsocket:rsocket-transport-local:0.11.7'
9191
testCompile 'org.mockito:mockito-all:1.10.19'
9292
}
9393

rsocket-rpc-core/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ dependencies {
1010
compile 'io.opentracing:opentracing-api:0.31.0'
1111
compile 'javax.inject:javax.inject:1'
1212
compile 'com.google.protobuf:protobuf-java:3.6.1'
13-
compile 'io.rsocket:rsocket-core:0.11.6'
14-
compile 'io.rsocket:rsocket-transport-netty:0.11.6'
13+
compile 'io.rsocket:rsocket-core:0.11.7'
14+
compile 'io.rsocket:rsocket-transport-netty:0.11.7'
1515
compile 'io.micrometer:micrometer-core:1.0.6'
1616

1717
protobuf project(':rsocket-rpc-metrics-idl')

rsocket-rpc-core/src/main/java/io/rsocket/rpc/frames/Metadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static ByteBuf encode(
3333
ByteBufUtil.reserveAndWriteUtf8(byteBuf, method, methodLength);
3434

3535
byteBuf.writeShort(tracing.readableBytes());
36-
byteBuf.writeBytes(tracing);
36+
byteBuf.writeBytes(tracing, tracing.readerIndex(), tracing.readableBytes());
3737

3838
byteBuf.writeBytes(metadata, metadata.readerIndex(), metadata.readableBytes());
3939

rsocket-rpc-protobuf/src/java_plugin/cpp/java_generator.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,11 @@ static void PrintClient(const ServiceDescriptor* service,
741741
p->Indent();
742742
p->Print(
743743
*vars,
744-
"final $ByteBuf$ tracingMetadata = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
745-
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracingMetadata, metadata);\n"
746-
"$ByteBuf$ data = serialize(message);\n"
747-
"tracingMetadata.release();\n"
744+
"final $ByteBuf$ data = serialize(message);\n"
745+
"final $ByteBuf$ tracing = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
746+
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracing, metadata);\n"
747+
"tracing.release();\n"
748+
"metadata.release();\n"
748749
"return rSocket.requestStream($ByteBufPayload$.create(data, metadataBuf));\n");
749750
p->Outdent();
750751
p->Print("}\n");
@@ -765,10 +766,11 @@ static void PrintClient(const ServiceDescriptor* service,
765766
p->Indent();
766767
p->Print(
767768
*vars,
768-
"final $ByteBuf$ tracingMetadata = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
769-
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracingMetadata, metadata);\n"
770-
"$ByteBuf$ data = serialize(message);\n"
771-
"tracingMetadata.release();\n"
769+
"final $ByteBuf$ data = serialize(message);\n"
770+
"final $ByteBuf$ tracing = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
771+
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracing, metadata);\n"
772+
"tracing.release();\n"
773+
"metadata.release();\n"
772774
"return rSocket.fireAndForget($ByteBufPayload$.create(data, metadataBuf));\n");
773775
p->Outdent();
774776
p->Print("}\n");
@@ -788,10 +790,11 @@ static void PrintClient(const ServiceDescriptor* service,
788790
p->Indent();
789791
p->Print(
790792
*vars,
791-
"final $ByteBuf$ tracingMetadata = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
792-
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracingMetadata, metadata);\n"
793-
"$ByteBuf$ data = serialize(message);\n"
794-
"tracingMetadata.release();\n"
793+
"final $ByteBuf$ data = serialize(message);\n"
794+
"final $ByteBuf$ tracing = $RSocketRpcTracing$.mapToByteBuf($ByteBufAllocator$.DEFAULT, map);\n"
795+
"final $ByteBuf$ metadataBuf = $RSocketRpcMetadata$.encode($ByteBufAllocator$.DEFAULT, $service_name$.$service_field_name$, $service_name$.$method_field_name$, tracing, metadata);\n"
796+
"tracing.release();\n"
797+
"metadata.release();\n"
795798
"return rSocket.requestResponse($ByteBufPayload$.create(data, metadataBuf));\n");
796799
p->Outdent();
797800
p->Print("}\n");

0 commit comments

Comments
 (0)