Skip to content

Commit

Permalink
[BACKPORT 2.20][PLAT-14524] Up-version pekko to fix TLSActor infinite…
Browse files Browse the repository at this point in the history
… loop

Summary:
We observe high CPU usage from YBA Java process on yba-installer portal with really high memory allocation rate.
It will continue until YBA restart in case it happened.
The issue is related to some edge case in Akka <-> JDK interaction in terms of TLS. Seems like related to TLS1.3 somehow as well: akka/akka#29922
They implemented the workaround to limit the infinite loop here, and it was working: akka/akka#31947
This fix was backported in Pekko: apache/pekko@9662048
But, if you look closer at case NEED_WRAP => code in both commits - Pekko code also has flushToUser() call, before this infinite loop check.
And the issue here is that flushToUser will reset the counter they use for infinite loop check..
So, the fix does not work in Pekko,
Luckily, later they had another commit in Pekko, which should fix the above issue: apache/pekko@1e41829
So, we basically need to up-version pekko.

Original diff: https://phorge.dev.yugabyte.com/D36239

Test Plan: Tested manually that YBA works

Reviewers: #yba-api-review!, nsingh, muthu, dshubin, sneelakantan

Reviewed By: muthu, dshubin

Subscribers: anijhawan, sneelakantan, yugaware

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D36328
  • Loading branch information
anmalysh-yb committed Jul 4, 2024
1 parent 23dc262 commit a4a7ccd
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 20 deletions.
2 changes: 1 addition & 1 deletion managed/.sbtopts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-J-XX:MinHeapFreeRatio=10
-J-XX:MaxHeapFreeRatio=20
-J-Xmx2g
-J-Xmx3g
-J-XX:MaxMetaspaceSize=1g
-J-XX:MetaspaceSize=500m
-Dlogback.configurationFile=logback-sbt.xml
Expand Down
31 changes: 25 additions & 6 deletions managed/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ libraryDependencies ++= Seq(
"org.pac4j" %% "play-pac4j" % "9.0.2",
"org.pac4j" % "pac4j-oauth" % "4.5.7" exclude("commons-io" , "commons-io"),
"org.pac4j" % "pac4j-oidc" % "4.5.7" exclude("commons-io" , "commons-io"),
"org.playframework" %% "play-json" % "3.0.1",
"org.playframework" %% "play-json" % "3.0.4",
"commons-validator" % "commons-validator" % "1.8.0",
"org.apache.velocity" % "velocity-engine-core" % "2.3",
"com.fasterxml.woodstox" % "woodstox-core" % "6.4.0",
Expand Down Expand Up @@ -516,7 +516,28 @@ dependencyOverrides += "com.google.guava" % "guava" % "32.1.1-jre"
dependencyOverrides += "com.nimbusds" % "oauth2-oidc-sdk" % "7.1.1"
dependencyOverrides += "org.reflections" % "reflections" % "0.10.2"

val jacksonVersion = "2.15.3"
// This is a custom version, built based on 1.0.3 with the following commit added on top:
// https://github.com/apache/pekko/commit/1e41829bf7abeec268b9a409f35051ed7f4e0090.
// This is required to fix TLS infinite loop issue, which causes high CPU usage.
// We can't use 1.1.0-M1 version yet, as it has the following issue:
// https://github.com/playframework/playframework/pull/12662
// Once the issue is fixed we should migrate back on stable version.
val pekkoVersion = "1.0.3-tls-loop-fix"

val pekkoLibs = Seq(
"org.apache.pekko" %% "pekko-actor-typed",
"org.apache.pekko" %% "pekko-actor",
"org.apache.pekko" %% "pekko-protobuf-v3",
"org.apache.pekko" %% "pekko-serialization-jackson",
"org.apache.pekko" %% "pekko-slf4j",
"org.apache.pekko" %% "pekko-stream",
)

val pekkoOverrides = pekkoLibs.map(_ % pekkoVersion)

dependencyOverrides ++= pekkoOverrides

val jacksonVersion = "2.17.1"

val jacksonLibs = Seq(
"com.fasterxml.jackson.core" % "jackson-core",
Expand Down Expand Up @@ -623,9 +644,6 @@ val swaggerGen: TaskKey[Unit] = taskKey[Unit](
"generate swagger.json"
)

val swaggerJacksonVersion = "2.11.1"
val swaggerJacksonOverrides = jacksonLibs.map(_ % swaggerJacksonVersion)

lazy val swagger = project
.dependsOn(root % "compile->compile;test->test")
.settings(commonSettings)
Expand All @@ -637,7 +655,8 @@ lazy val swagger = project
"com.github.dwickern" %% "swagger-play3.0" % "4.0.0"
),

dependencyOverrides ++= swaggerJacksonOverrides,
dependencyOverrides ++= pekkoOverrides,
dependencyOverrides ++= jacksonOverrides,
dependencyOverrides += "org.scala-lang.modules" %% "scala-xml" % "2.1.0",

swaggerGen := Def.taskDyn {
Expand Down
2 changes: 1 addition & 1 deletion managed/project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencyOverrides ++= jacksonOverrides
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.14"

// The Play plugin
addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.0")
addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.4")

// ORM
addSbtPlugin("org.playframework" % "sbt-play-ebean" % "8.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.yugabyte.yw.forms;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yugabyte.yw.common.Util;
import com.yugabyte.yw.common.backuprestore.BackupUtil;
import com.yugabyte.yw.models.Backup.StorageConfigType;
Expand Down Expand Up @@ -341,10 +342,12 @@ public List<String> getTableNameList() {
return new ArrayList<String>();
}

@JsonProperty("isFullBackup")
public boolean isFullBackup() {
return isFullBackup;
}

@JsonProperty("isFullBackup")
public void setFullBackup(boolean isFullBackup) {
this.isFullBackup = isFullBackup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package com.yugabyte.yw.forms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase;
import com.yugabyte.yw.metrics.MetricSettings;
import com.yugabyte.yw.models.common.YbaApi;
Expand Down Expand Up @@ -67,6 +68,7 @@ public class MetricQueryParams {

@ApiModelProperty(value = "YbaApi Internal. Is Recharts")
@YbaApi(visibility = YbaApiVisibility.INTERNAL, sinceYBAVersion = "2.14.0.0")
@JsonProperty("isRecharts")
private boolean isRecharts;

@ApiModelProperty(value = "YbaApi Internal. List of metrics with custom settings")
Expand Down
4 changes: 4 additions & 0 deletions managed/src/main/java/com/yugabyte/yw/models/BackupResp.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.yugabyte.yw.models;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yugabyte.yw.models.Backup.BackupCategory;
import com.yugabyte.yw.models.Backup.BackupState;
import com.yugabyte.yw.models.Backup.StorageConfigType;
Expand Down Expand Up @@ -36,7 +37,10 @@ public class BackupResp {
Boolean onDemand;
StorageConfigType storageConfigType;
BackupCategory category;

@JsonProperty("isFullBackup")
Boolean isFullBackup;

TableType backupType;
CommonBackupInfo commonBackupInfo;
String scheduleName;
Expand Down
4 changes: 0 additions & 4 deletions managed/src/main/java/com/yugabyte/yw/models/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import com.cronutils.model.time.ExecutionTime;
import com.cronutils.parser.CronParser;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
Expand Down Expand Up @@ -126,8 +124,6 @@ public SortByIF getOrderField() {
@Column(nullable = false)
private UUID customerUUID;

@JsonProperty
@JsonIgnore
public void setCustomerUUID(UUID customerUUID) {
this.customerUUID = customerUUID;
ObjectNode scheduleTaskParams = (ObjectNode) getTaskParams();
Expand Down
2 changes: 2 additions & 0 deletions managed/src/main/java/com/yugabyte/yw/models/Users.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yugabyte.yw.common.PlatformServiceException;
import com.yugabyte.yw.common.concurrent.KeyLock;
import com.yugabyte.yw.common.encryption.HashBuilder;
Expand Down Expand Up @@ -169,6 +170,7 @@ public void setPassword(String password) {
private Role role;

@ApiModelProperty(value = "True if the user is the primary user")
@JsonProperty("isPrimary")
private boolean isPrimary;

@ApiModelProperty(value = "User Type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package com.yugabyte.yw.models.helpers;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
Expand Down Expand Up @@ -34,10 +35,22 @@ public class NodeConfig {
@ApiModel(description = "Validation result of a node config")
public static class ValidationResult {
private Type type;

private boolean isValid;
private boolean isRequired;

private String description;
private String value;

@JsonProperty("isValid")
public boolean isValid() {
return isValid;
}

@JsonProperty("isRequired")
public boolean isRequired() {
return isRequired;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.yugabyte.yw.models.helpers.provider;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.*;
import com.yugabyte.yw.common.CloudProviderHelper.EditableInUseProvider;
import com.yugabyte.yw.models.common.YbaApi;
import com.yugabyte.yw.models.common.YbaApi.YbaApiVisibility;
Expand Down Expand Up @@ -79,6 +76,7 @@ public class KubernetesInfo implements CloudInfoInterface {
@EditableInUseProvider(name = "Kubernetes Pull Secret Name", allowed = false)
private String kubernetesPullSecretName;

@JsonProperty("isKubernetesOperatorControlled")
// Flag for identifying the legacy k8s providers created before release 2.18.
@ApiModelProperty(hidden = true)
private boolean legacyK8sProvider = true;
Expand Down
13 changes: 11 additions & 2 deletions managed/src/main/resources/swagger-strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,7 @@
"type" : "boolean"
},
"isFullBackup" : {
"readOnly" : true,
"type" : "boolean"
},
"isStorageConfigPresent" : {
Expand Down Expand Up @@ -2153,7 +2154,7 @@
"type" : "boolean"
}
},
"required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isFullBackup", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ],
"required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ],
"type" : "object"
},
"BackupStorageInfo" : {
Expand Down Expand Up @@ -5862,6 +5863,9 @@
},
"KubernetesInfo" : {
"properties" : {
"isKubernetesOperatorControlled" : {
"type" : "boolean"
},
"kubeConfig" : {
"readOnly" : true,
"type" : "string"
Expand Down Expand Up @@ -6170,6 +6174,9 @@
"certManagerIssuer" : {
"type" : "string"
},
"isKubernetesOperatorControlled" : {
"type" : "boolean"
},
"kubeConfig" : {
"readOnly" : true,
"type" : "string"
Expand Down Expand Up @@ -14588,9 +14595,11 @@
"type" : "string"
},
"isRequired" : {
"readOnly" : true,
"type" : "boolean"
},
"isValid" : {
"readOnly" : true,
"type" : "boolean"
},
"type" : {
Expand All @@ -14601,7 +14610,7 @@
"type" : "string"
}
},
"required" : [ "description", "isRequired", "isValid", "type", "value" ],
"required" : [ "description", "type", "value" ],
"type" : "object"
},
"VolumeDetails" : {
Expand Down
13 changes: 11 additions & 2 deletions managed/src/main/resources/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,7 @@
"type" : "boolean"
},
"isFullBackup" : {
"readOnly" : true,
"type" : "boolean"
},
"isStorageConfigPresent" : {
Expand Down Expand Up @@ -2169,7 +2170,7 @@
"type" : "boolean"
}
},
"required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isFullBackup", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ],
"required" : [ "backupType", "category", "commonBackupInfo", "customerUUID", "expiryTimeUnit", "fullChainSizeInBytes", "hasIncrementalBackups", "isStorageConfigPresent", "isUniversePresent", "lastBackupState", "onDemand", "scheduleName", "scheduleUUID", "storageConfigType", "universeName", "universeUUID", "useTablespaces" ],
"type" : "object"
},
"BackupStorageInfo" : {
Expand Down Expand Up @@ -5901,6 +5902,9 @@
},
"KubernetesInfo" : {
"properties" : {
"isKubernetesOperatorControlled" : {
"type" : "boolean"
},
"kubeConfig" : {
"readOnly" : true,
"type" : "string"
Expand Down Expand Up @@ -6213,6 +6217,9 @@
"certManagerIssuer" : {
"type" : "string"
},
"isKubernetesOperatorControlled" : {
"type" : "boolean"
},
"kubeConfig" : {
"readOnly" : true,
"type" : "string"
Expand Down Expand Up @@ -14733,9 +14740,11 @@
"type" : "string"
},
"isRequired" : {
"readOnly" : true,
"type" : "boolean"
},
"isValid" : {
"readOnly" : true,
"type" : "boolean"
},
"type" : {
Expand All @@ -14746,7 +14755,7 @@
"type" : "string"
}
},
"required" : [ "description", "isRequired", "isValid", "type", "value" ],
"required" : [ "description", "type", "value" ],
"type" : "object"
},
"VolumeDetails" : {
Expand Down

0 comments on commit a4a7ccd

Please sign in to comment.