From c58b5db48dc7853f27b7731513bbfd5e0e360d3d Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Wed, 18 Jun 2025 10:09:47 +0530 Subject: [PATCH 1/4] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 12 ++++++------ ballerina/Dependencies.toml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index cb5219189..60ac5bd67 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -24,7 +24,7 @@ path = "../test-utils/build/libs/grpc-test-utils-1.13.0-SNAPSHOT.jar" scope = "testOnly" [[platform.java21.dependency]] -path = "./lib/ballerina-cli-2201.11.0-20241121-075100-c4c87cbc.jar" +path = "./lib/ballerina-cli-2201.11.0-20241204-163800-0d1e4836.jar" scope = "testOnly" [[platform.java21.dependency]] @@ -35,7 +35,7 @@ scope = "testOnly" groupId = "io.ballerina.stdlib" artifactId = "http-native" version = "2.13.0" -path = "./lib/http-native-2.13.0-20241126-181000-6585cc5.jar" +path = "./lib/http-native-2.13.0-20241205-101300-81ebb2d.jar" [[platform.java21.dependency]] groupId = "io.netty" @@ -163,11 +163,11 @@ path = "./lib/proto-google-common-protos-1.17.0.jar" [[platform.java21.dependency]] groupId = "org.ballerinalang" artifactId = "formatter-core" -version = "2201.11.0-20241121-075100-c4c87cbc" -path = "./lib/formatter-core-2201.11.0-20241121-075100-c4c87cbc.jar" +version = "2201.11.0-20241204-163800-0d1e4836" +path = "./lib/formatter-core-2201.11.0-20241204-163800-0d1e4836.jar" [[platform.java21.dependency]] groupId = "org.ballerinalang" artifactId = "ballerina-parser" -version = "2201.11.0-20241121-075100-c4c87cbc" -path = "./lib/ballerina-parser-2201.11.0-20241121-075100-c4c87cbc.jar" +version = "2201.11.0-20241204-163800-0d1e4836" +path = "./lib/ballerina-parser-2201.11.0-20241204-163800-0d1e4836.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 840053187..5ad5ffc26 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,7 +5,7 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.11.0-20241121-075100-c4c87cbc" +distribution-version = "2201.11.0-20241204-163800-0d1e4836" [[package]] org = "ballerina" @@ -104,7 +104,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.13.0" +version = "2.13.5" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, From 8e092e46adbfe6c6ed22daf8b8e4349876553015 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Thu, 3 Jul 2025 11:41:17 +0530 Subject: [PATCH 2/4] [Automated] Update the native jar versions --- ballerina/Dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 5ad5ffc26..2a0578d6a 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -104,7 +104,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.13.5" +version = "2.13.0" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, From 49631689ef9b39a6d518abb9c0e66b692cc35848 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Thu, 22 Jan 2026 12:15:23 +0530 Subject: [PATCH 3/4] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 8 ++++---- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index a29dd5980..8695920be 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "grpc" -version = "1.14.3" +version = "1.14.4" distribution = "2201.12.0" authors = ["Ballerina"] keywords = ["network", "grpc", "protobuf", "server-streaming", "client-streaming", "bidirectional-streaming"] @@ -16,11 +16,11 @@ graalvmCompatible = true [[platform.java21.dependency]] groupId = "io.ballerina.stdlib" artifactId = "grpc-native" -version = "1.14.3" -path = "../native/build/libs/grpc-native-1.14.3.jar" +version = "1.14.4" +path = "../native/build/libs/grpc-native-1.14.4-SNAPSHOT.jar" [[platform.java21.dependency]] -path = "../test-utils/build/libs/grpc-test-utils-1.14.3.jar" +path = "../test-utils/build/libs/grpc-test-utils-1.14.4-SNAPSHOT.jar" scope = "testOnly" [[platform.java21.dependency]] diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index cf89364ab..2ce8da1d8 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "grpc-compiler-plugin" class = "io.ballerina.stdlib.grpc.plugin.GrpcCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/grpc-compiler-plugin-1.14.3.jar" +path = "../compiler-plugin/build/libs/grpc-compiler-plugin-1.14.4-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index a17315257..1bc8dc27a 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -44,7 +44,7 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.9.2" +version = "2.9.3" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -78,7 +78,7 @@ dependencies = [ [[package]] org = "ballerina" name = "grpc" -version = "1.14.3" +version = "1.14.4" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "crypto"}, @@ -302,7 +302,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.5.0" +version = "1.5.1" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] From 17a94ca2b548cbbd7ecfdee3c5e453999bdf0ce0 Mon Sep 17 00:00:00 2001 From: Danesh Kuruppu Date: Thu, 22 Jan 2026 16:07:51 +0530 Subject: [PATCH 4/4] fix the server startup issue --- .../io/ballerina/stdlib/grpc/GrpcUtil.java | 11 ++++++++ .../serviceendpoint/FunctionUtils.java | 27 ++++++++++++++----- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/native/src/main/java/io/ballerina/stdlib/grpc/GrpcUtil.java b/native/src/main/java/io/ballerina/stdlib/grpc/GrpcUtil.java index e51e311e0..c2d495a2d 100644 --- a/native/src/main/java/io/ballerina/stdlib/grpc/GrpcUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/grpc/GrpcUtil.java @@ -80,6 +80,9 @@ private GrpcUtil() { private static final Logger log = LoggerFactory.getLogger(GrpcUtil.class); + private static final int BUFFER_SIZE = 1048576; + private static final int BACK_LOG = 100; + public static ConnectionManager getConnectionManager(BMap poolStruct) { ConnectionManager poolManager = (ConnectionManager) poolStruct.getNativeData(CONNECTION_MANAGER); @@ -233,6 +236,8 @@ public static ListenerConfiguration getListenerConfig(long port, BMap endpointCo listenerConfiguration.setServerHeader(getServerName()); } + setSocketConfig(listenerConfiguration); + if (sslConfig != null) { return setSslConfig(sslConfig, listenerConfiguration); } @@ -246,6 +251,12 @@ public static ListenerConfiguration getListenerConfig(long port, BMap endpointCo return listenerConfiguration; } + private static void setSocketConfig(ListenerConfiguration listenerConfiguration) { + listenerConfiguration.setReceiveBufferSize(BUFFER_SIZE); + listenerConfiguration.setSendBufferSize(BUFFER_SIZE); + listenerConfiguration.setSoBackLog(BACK_LOG); + } + private static String getServerName() { String userAgent; diff --git a/native/src/main/java/io/ballerina/stdlib/grpc/nativeimpl/serviceendpoint/FunctionUtils.java b/native/src/main/java/io/ballerina/stdlib/grpc/nativeimpl/serviceendpoint/FunctionUtils.java index 6ac0a4f99..dc8ce3eb0 100644 --- a/native/src/main/java/io/ballerina/stdlib/grpc/nativeimpl/serviceendpoint/FunctionUtils.java +++ b/native/src/main/java/io/ballerina/stdlib/grpc/nativeimpl/serviceendpoint/FunctionUtils.java @@ -152,7 +152,7 @@ private static Object startServerConnector(BObject listener, ServicesRegistry se try { serverConnectorFuture.sync(); } catch (Exception ex) { - return MessageUtils.getConnectorError(new StatusRuntimeException(Status + throw MessageUtils.getConnectorError(new StatusRuntimeException(Status .fromCode(Status.Code.INTERNAL.toStatus().getCode()).withDescription( "Failed to start server connector '" + serverConnector.getConnectorID() + "'. " + ex.getMessage()))); @@ -192,9 +192,15 @@ public static Object externStart(BObject listener) { */ public static Object gracefulStop(BObject serverEndpoint) { - getServerConnector(serverEndpoint).stop(); - serverEndpoint.addNativeData(GrpcConstants.CONNECTOR_STARTED, false); - return null; + try { + getServerConnector(serverEndpoint).stop(); + serverEndpoint.addNativeData(GrpcConstants.CONNECTOR_STARTED, false); + return null; + } catch (Exception ex) { + return MessageUtils.getConnectorError(new StatusRuntimeException(Status + .fromCode(Status.Code.INTERNAL.toStatus().getCode()).withDescription( + "Failed to stop server connector gracefully. " + ex.getMessage()))); + } } /** @@ -204,9 +210,16 @@ public static Object gracefulStop(BObject serverEndpoint) { * @return Error if there is an error while stopping the server, else returns nil. */ public static Object immediateStop(BObject serverEndpoint) { - getServerConnector(serverEndpoint).immediateStop(); - serverEndpoint.addNativeData(GrpcConstants.CONNECTOR_STARTED, false); - return null; + + try { + getServerConnector(serverEndpoint).immediateStop(); + serverEndpoint.addNativeData(GrpcConstants.CONNECTOR_STARTED, false); + return null; + } catch (Exception ex) { + return MessageUtils.getConnectorError(new StatusRuntimeException(Status + .fromCode(Status.Code.INTERNAL.toStatus().getCode()).withDescription( + "Failed to stop server connector immediately. " + ex.getMessage()))); + } } public static Object nextResult(Environment env, BObject streamIterator) {