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

feat(be): implement feature of judging in java #2323

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
19 changes: 10 additions & 9 deletions apps/iris/src/service/sandbox/langConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 " +
Copy link
Contributor Author

@gyunseo gyunseo Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jspark2000 이 당시에 뒤에 k를 붙였던 이유가 있었나요? 막연히 kilobyte라고 생각해서 일단 떼어 냈습니다.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

원래부터 있었던 거라 특별한 이유는 잘 모르겠습니다..

"-XX:MaxRAM={maxMemory} " +
"-Djava.security.manager " +
"-Dfile.encoding=UTF-8 " +
"-Djava.security.policy==" +
Expand Down Expand Up @@ -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),
Expand All @@ -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
}

Expand Down