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

fix: specify jvm env variables explicitly for local profile #405

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion resources/profiles/custom-spec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
local: # 3 nodes, ~950 TPS (Docker Desktop 8 cores, 16 GB RAM)
local: # 3 nodes, ~850 TPS (Docker Desktop 8 cores, 16 GB RAM)
consensus: # use chart defaults
root:
extraEnv:
- name: JAVA_HEAP_MIN
value: 1g
- name: JAVA_HEAP_MAX
value: 3g
- name: JAVA_OPTS
value: "-XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:ZAllocationSpikeTolerance=2 -XX:ConcGCThreads=2 -XX:ZMarkStackSpaceLimit=1g -XX:MaxDirectMemorySize=1g -XX:MetaspaceSize=100M -Xlog:gc*:gc.log --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true"
haproxy: # use chart defaults
envoyProxy: # use chart defaults
rpcRelay:
Expand Down
12 changes: 9 additions & 3 deletions src/core/profile_manager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,17 @@
const dotItems = dot.dot(items)

for (const key in dotItems) {
let itemKey = key

// if it is an array key like extraEnv[0].JAVA_OPTS, convert it into dot separated key as extraEnv.0.JAVA_OPTS
if (key.indexOf('[') !== -1) {
itemKey = key.replace('[', '.').replace(']', '')

Check warning on line 157 in src/core/profile_manager.mjs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/core/profile_manager.mjs#L157

`key.replace` method will only replace the first occurrence when used with a string argument ('['). If this method is used for escaping of dangerous data then there is a possibility for a bypass.
}

if (itemPath) {
this._setValue(`${itemPath}.${key}`, dotItems[key], yamlRoot)
this._setValue(`${itemPath}.${itemKey}`, dotItems[key], yamlRoot)
} else {
this._setValue(key, dotItems[key], yamlRoot)
this._setValue(itemKey, dotItems[key], yamlRoot)
}
}
}
Expand All @@ -173,7 +180,6 @@
for (let nodeIndex = 0; nodeIndex < nodeIds.length; nodeIndex++) {
this._setValue(`hedera.nodes.${nodeIndex}.name`, nodeIds[nodeIndex], yamlRoot)
this._setValue(`hedera.nodes.${nodeIndex}.accountId`, accountMap.get(nodeIds[nodeIndex]), yamlRoot)
this._setChartItems(`hedera.nodes.${nodeIndex}`, profile.consensus, yamlRoot)
}

const stagingDir = Templates.renderStagingDir(
Expand Down
Loading