Skip to content

Commit

Permalink
Using --memlimit to forbid OOMs
Browse files Browse the repository at this point in the history
Fix in theta-start.sh

Reverted theta-start.sh

Updated theta-start.sh
  • Loading branch information
leventeBajczi committed Nov 14, 2024
1 parent 2447102 commit cf0967c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/theta-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ remove_property() {
}

if [ "$1" == "--version" ]; then
LD_LIBRARY_PATH=$scriptdir/lib java -Xss120m -Xmx14210m -jar "$scriptdir"/theta.jar --version
LD_LIBRARY_PATH=$scriptdir/lib java -Xss120m -Xmx14210m -jar "$scriptdir"/theta.jar --version || echo $VERIFIER_VERSION
else
modified_args=$(remove_property "${@:2}")
property=$(cat .property && rm .property)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ class InProcessChecker<F : SpecFrontendConfig, B : SpecBackendConfig>(
getGson(xcfa).toJson(processConfig)
}

val heapSize =
"-Xmx${if(config.backendConfig.memlimit == 0L) 1420L else config.backendConfig.memlimit/1024/1024 }m"
logger.write(Logger.Level.INFO, "Starting process with $heapSize of heap\n")

val pb =
NuProcessBuilder(
listOf(
ProcessHandle.current().info().command().orElse("java"),
"-Xss120m",
"-Xmx14210m",
heapSize,
"-cp",
File(XcfaCli::class.java.protectionDomain.codeSource.location.toURI()).absolutePath,
XcfaCli::class.qualifiedName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ data class BackendConfig<T : SpecBackendConfig>(
var timeoutMs: Long = 0,
@Parameter(names = ["--in-process"], description = "Run analysis in process")
var inProcess: Boolean = false,
@Parameter(
names = ["--memlimit"],
description = "Maximum memory to use when --in-process (in bytes, 0 for default)",
)
var memlimit: Long = 0L,
override var specConfig: T? = null,
) : SpecializableConfig<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fun boundedPortfolio25(
backendConfig =
BackendConfig(
backend = Backend.BOUNDED,
memlimit = portfolioConfig.backendConfig.memlimit,
solverHome = portfolioConfig.backendConfig.solverHome,
timeoutMs = 0,
specConfig =
Expand Down Expand Up @@ -93,6 +94,7 @@ fun boundedPortfolio25(
backendConfig =
BackendConfig(
backend = Backend.MDD,
memlimit = portfolioConfig.backendConfig.memlimit,
solverHome = portfolioConfig.backendConfig.solverHome,
timeoutMs = 0,
specConfig =
Expand Down

0 comments on commit cf0967c

Please sign in to comment.