diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e5ab574ce8..b825df6281 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -33,3 +33,9 @@ RUN architecture=$(dpkg --print-architecture) && if [ "$architecture" = "arm64" && unzip awscli.zip \ && ./aws/install \ && rm -rf aws awscli.zip + +# Install Java +RUN apt-get -y update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends openjdk-17-jdk \ + && apt-get -y clean \ + && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/apps/iris/src/service/sandbox/langConfig.go b/apps/iris/src/service/sandbox/langConfig.go index 992779f4f4..2b5b90df95 100644 --- a/apps/iris/src/service/sandbox/langConfig.go +++ b/apps/iris/src/service/sandbox/langConfig.go @@ -123,7 +123,7 @@ func NewLangConfig(file file.FileManager, javaPolicyPath string) *langConfig { CompileArgs: "{srcPath} -d {exeDir} -encoding UTF8", RunCommand: "/usr/bin/java", RunArgs: "-cp {exeDir} " + - "-XX:MaxRAM={maxMemory}k " + + "-XX:MaxRAM={maxMemory} " + "-Djava.security.manager " + "-Dfile.encoding=UTF-8 " + "-Djava.security.policy==" + @@ -263,9 +263,9 @@ func (l *langConfig) ToRunExecArgs(dir string, language Language, order int, lim } maxMemory := limit.Memory - if c.Language == JAVA { - maxMemory = -1 - } + // if c.Language == JAVA { + // maxMemory = -1 + // } return ExecArgs{ ExePath: strings.Replace(c.RunCommand, "{exePath}", exePath, 1), @@ -277,11 +277,12 @@ func (l *langConfig) ToRunExecArgs(dir string, language Language, order int, lim MaxOutputSize: 10 * 1024 * 1024, // file에 쓰는거랑 stdout이랑 크게 차이 안남 // https://stackoverflow.com/questions/29700478/redirecting-of-stdout-in-bash-vs-writing-to-file-in-c-with-fprintf-speed - OutputPath: outputPath, - ErrorPath: errorPath, // byte buffer로 - LogPath: constants.RUN_LOG_PATH, - SeccompRuleName: c.SeccompRule, - Args: argSlice, + OutputPath: outputPath, + ErrorPath: errorPath, // byte buffer로 + LogPath: constants.RUN_LOG_PATH, + SeccompRuleName: c.SeccompRule, + MemoryLimitCheckOnly: c.MemoeryLimitCheckOnly, + Args: argSlice, }, nil }