Skip to content

Commit

Permalink
[PLAT-14524] Up-version pekko to fix TLSActor infinite loop
Browse files Browse the repository at this point in the history
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.

Test Plan: Tested manually that YBA works

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

Reviewed By: #yba-api-review, dshubin, sneelakantan

Subscribers: anijhawan, sneelakantan, yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D36239
  • Loading branch information
anmalysh-yb committed Jul 2, 2024
1 parent af49a1e commit f3c4e14
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 23 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 @@ -203,7 +203,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 @@ -968,7 +968,28 @@ dependencyOverrides += "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5"
dependencyOverrides += "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6" % Test
dependencyOverrides += "com.fasterxml.jackson.module" % "jackson-module-jaxb-annotations" % "2.10.1" % Test

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 @@ -1107,9 +1128,6 @@ val swaggerGenTest: TaskKey[Unit] = taskKey[Unit](
"test 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 @@ -1121,7 +1139,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 @@ -22,7 +22,7 @@ dependencyOverrides += "com.google.googlejavaformat" % "google-java-format" % "1
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 @@ -340,10 +341,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 @@ -172,6 +173,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 @@ -80,6 +77,7 @@ public class KubernetesInfo implements CloudInfoInterface {
private String kubernetesPullSecretName;

@ApiModelProperty(accessMode = AccessMode.READ_ONLY)
@JsonProperty("isKubernetesOperatorControlled")
public boolean isKubernetesOperatorControlled = false;

// Flag for identifying the legacy k8s providers created before release 2.18.
Expand Down
10 changes: 5 additions & 5 deletions managed/src/main/resources/swagger-strict.json
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,7 @@
"type" : "boolean"
},
"isFullBackup" : {
"readOnly" : true,
"type" : "boolean"
},
"isStorageConfigPresent" : {
Expand Down Expand Up @@ -2435,7 +2436,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 @@ -8033,9 +8034,6 @@
"example" : "{\"ip\":\"1.1.1.1\",\"sshUser\":\"centos\"}",
"type" : "string"
},
"inUse" : {
"type" : "boolean"
},
"instanceName" : {
"description" : "The node instance's name",
"example" : "Mumbai instance",
Expand Down Expand Up @@ -15199,9 +15197,11 @@
"type" : "string"
},
"isRequired" : {
"readOnly" : true,
"type" : "boolean"
},
"isValid" : {
"readOnly" : true,
"type" : "boolean"
},
"type" : {
Expand All @@ -15212,7 +15212,7 @@
"type" : "string"
}
},
"required" : [ "description", "isRequired", "isValid", "type", "value" ],
"required" : [ "description", "type", "value" ],
"type" : "object"
},
"VolumeDetails" : {
Expand Down
8 changes: 6 additions & 2 deletions managed/src/main/resources/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2408,6 +2408,7 @@
"type" : "boolean"
},
"isFullBackup" : {
"readOnly" : true,
"type" : "boolean"
},
"isStorageConfigPresent" : {
Expand Down Expand Up @@ -2451,7 +2452,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 @@ -8081,6 +8082,7 @@
"type" : "string"
},
"inUse" : {
"description" : "True if the node is in use <b style=\"color:#ff0000\">Deprecated since YBA version 2024.1.0.0.</b> Use NodeInstance.state instead",
"type" : "boolean"
},
"instanceName" : {
Expand Down Expand Up @@ -15344,9 +15346,11 @@
"type" : "string"
},
"isRequired" : {
"readOnly" : true,
"type" : "boolean"
},
"isValid" : {
"readOnly" : true,
"type" : "boolean"
},
"type" : {
Expand All @@ -15357,7 +15361,7 @@
"type" : "string"
}
},
"required" : [ "description", "isRequired", "isValid", "type", "value" ],
"required" : [ "description", "type", "value" ],
"type" : "object"
},
"VolumeDetails" : {
Expand Down

0 comments on commit f3c4e14

Please sign in to comment.