Skip to content

version 2.17.3#370

Merged
rlagkswn00 merged 2 commits intomainfrom
develop
Apr 4, 2026
Merged

version 2.17.3#370
rlagkswn00 merged 2 commits intomainfrom
develop

Conversation

@rlagkswn00
Copy link
Copy Markdown
Member

@rlagkswn00 rlagkswn00 commented Apr 2, 2026

version 2.17.3

Summary by CodeRabbit

릴리스 노트

  • Chores
    • 애플리케이션 로그가 파일로 저장되도록 개선
    • 데이터베이스 관계 처리 로직 강화
    • 데이터베이스 인덱스 최적화

* fix: club entity and schema cleanup (#352)

* fix: remove weak club mapping test (#367)
@rlagkswn00 rlagkswn00 self-assigned this Apr 2, 2026
@rlagkswn00 rlagkswn00 added the 🚀 Deploy Production deploy production server label Apr 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Walkthrough

세 가지 주요 변경사항이 포함되어 있습니다: 시작 스크립트에 애플리케이션 로그 파일 리다이렉션 추가, Club 엔티티의 JPA 관계 설정에 계단식 삭제 및 고아 제거 옵션 추가, 그리고 데이터베이스 마이그레이션 스크립트로 중복 인덱스 안전 삭제.

Changes

Cohort / File(s) Summary
로깅 및 프로세스 관리
scripts/start.sh
애플리케이션 로그 파일 경로 변수 추가(APP_LOG="$PROJECT_ROOT/application.log") 및 JAR 실행 시 표준 출력/오류를 로그 파일로 리다이렉션, stdin 리다이렉션 추가.
JPA 엔티티 관계 설정
src/main/java/com/kustacks/kuring/club/domain/Club.java
homepageUrls 필드의 @OneToMany 어노테이션에 cascade = CascadeType.ALLorphanRemoval = true 옵션 추가하여 계단식 삭제 및 고아 엔티티 자동 제거 활성화.
데이터베이스 마이그레이션
src/main/resources/db/migration/V260326__Drop_duplicate_club_subscribe_index.sql
중복 인덱스(idx_club_subscribe_club)를 안전하게 제거하는 마이그레이션 스크립트 추가. 인덱스 존재 여부를 확인한 후 조건부로 DROP INDEX 실행.

Poem

🐰 로그는 흐르고, 관계는 깨끗하고,
인덱스는 정리되니 모두 반갑네.
계단식 삭제로 데이터 일관성,
스크립트 하나가 모든 것을 바꾸네!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive PR 제목 'version 2.17.3'는 버전 번호만 나타내며, 실제 변경사항(스크립트 I/O 리디렉션, JPA 캐스케이드 설정, DB 마이그레이션)을 구체적으로 설명하지 않습니다. 제목을 'version 2.17.3: 로깅, 캐스케이드 설정, 인덱스 마이그레이션' 또는 더 구체적인 변경사항 요약으로 변경하는 것을 권장합니다.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Unit Test Results

  84 files  ±0    84 suites  ±0   1m 33s ⏱️ -2s
597 tests ±0  590 ✔️ ±0  7 💤 ±0  0 ±0 
600 runs  ±0  593 ✔️ ±0  7 💤 ±0  0 ±0 

Results for commit 4bb3ecc. ± Comparison against base commit 4a68049.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/start.sh`:
- Line 22: The nohup java command currently places JVM options after -jar so
they are passed as application args and not applied; update the command that
starts the JVM (the nohup java ... line invoking $JAR_FILE and $APP_LOG) so that
all JVM options (-Dspring.profiles.active=prod, -Xms256m, -Xmx256m) appear
before -jar and the jar file ($JAR_FILE) follows -jar, preserving the
redirection and backgrounding (nohup ... > "$APP_LOG" 2>&1 < /dev/null &).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c8baa6c-5c20-4ef3-b14f-d13e9684e1f3

📥 Commits

Reviewing files that changed from the base of the PR and between 4a68049 and 4bb3ecc.

📒 Files selected for processing (3)
  • scripts/start.sh
  • src/main/java/com/kustacks/kuring/club/domain/Club.java
  • src/main/resources/db/migration/V260326__Drop_duplicate_club_subscribe_index.sql

Comment thread scripts/start.sh
chmod 755 $JAR_FILE
echo "$TIME_NOW > $JAR_FILE 파일 실행" >> $DEPLOY_LOG
nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE &
nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE > "$APP_LOG" 2>&1 < /dev/null &
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Apr 2, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "[1] 잘못된 패턴 탐지: -jar 뒤 JVM 옵션"
rg -nP --type sh 'java\s+-jar\s+-D|java\s+-jar\s+-Xms|java\s+-jar\s+-Xmx'

echo
echo "[2] 정상 패턴 참고: JVM 옵션 후 -jar"
rg -nP --type sh 'java\s+(-D\S+\s+)?(-Xms\S+\s+)?(-Xmx\S+\s+)?-jar\s+'

Repository: ku-ring/ku-ring-backend-web

Length of output: 380


🏁 Script executed:

cat -n scripts/start.sh | head -30

Repository: ku-ring/ku-ring-backend-web

Length of output: 897


🏁 Script executed:

# Line 6과 22 주변 컨텍스트 확인
sed -n '1,25p' scripts/start.sh | cat -n

Repository: ku-ring/ku-ring-backend-web

Length of output: 897


JVM 옵션 순서가 잘못되어 prod 프로필과 메모리 제한이 적용되지 않습니다.

Line 22에서 -Dspring.profiles.active=prod, -Xms256m, -Xmx256m-jar 뒤에 위치하고 있습니다. Java 표준 명령 형식 java [options] -jar jarfile [args...]에 따르면 JVM 옵션은 -jar 앞에 와야 합니다. 현재 위치에서는 이들이 jar 애플리케이션에 전달될 인자로 해석되어 JVM 옵션이 적용되지 않습니다.

수정 제안
-nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE > "$APP_LOG" 2>&1 < /dev/null &
+nohup java -Dspring.profiles.active=prod -Xms256m -Xmx256m -jar "$JAR_FILE" > "$APP_LOG" 2>&1 < /dev/null &
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE > "$APP_LOG" 2>&1 < /dev/null &
nohup java -Dspring.profiles.active=prod -Xms256m -Xmx256m -jar "$JAR_FILE" > "$APP_LOG" 2>&1 < /dev/null &
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/start.sh` at line 22, The nohup java command currently places JVM
options after -jar so they are passed as application args and not applied;
update the command that starts the JVM (the nohup java ... line invoking
$JAR_FILE and $APP_LOG) so that all JVM options (-Dspring.profiles.active=prod,
-Xms256m, -Xmx256m) appear before -jar and the jar file ($JAR_FILE) follows
-jar, preserving the redirection and backgrounding (nohup ... > "$APP_LOG" 2>&1
< /dev/null &).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

헐 진짜야? 그러면 그전까지 안됐어?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

JVM에 옵션을 전달하려면 -jar 옵션 에 위치시켜야 합니다. 현재 명령어에서 -Dspring.profiles.active=prod, -Xms256m, -Xmx256m-jar 뒤에 있지만 JAR 파일명(spring-webapp.jar) 앞에 있어, JVM 구현체에 따라 처리 방식이 달라질 수 있습니다.

실질적인 영향:

  • 일부 JVM(HotSpot 등)은 옵션 파싱이 관대하여 -D로 시작하는 인자와 -Xms, -Xmx 같은 인자를 위치와 무관하게 인식할 수도 있어서 앱 자체는 실행됐을 가능성이 높습니다.
  • 하지만 이는 표준 동작이 아니며, -Xms256m/-Xmx256m 메모리 제한이나 -Dspring.profiles.active=prod 프로필 설정이 실제로 적용되지 않았을 수도 있습니다.

정리: 앱이 완전히 실행 불가 상태였을 가능성은 낮지만, prod 프로필이나 메모리 제한이 실제로 적용되지 않은 채 운영되고 있었을 가능성이 있습니다.

아래와 같이 수정하는 것을 강하게 권장합니다:

-nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE > "$APP_LOG" 2>&1 < /dev/null &
+nohup java -Dspring.profiles.active=prod -Xms256m -Xmx256m -jar "$JAR_FILE" > "$APP_LOG" 2>&1 < /dev/null &

🌐 Web query:

java -jar JVM options after -jar argument order behavior
```[web_search]
```web
java -jar options after jar file treated as application arguments strict parsing
```

`@rlagkswn00` 네, 사실상 **이전부터 계속 문제가 있었을 가능성이 높습니다.** 단, 이 PR이 해당 버그를 _도입한_ 것은 아니고, 이미 기존 코드에서부터 존재하던 문제입니다.

조금 더 자세히 설명하면:

Oracle 공식 문서에 따르면, `-jar` 옵션을 사용할 경우 `-jar` 다음에 오는 **첫 번째 non-option 인자**가 JAR 파일로 인식됩니다. 그리고 Java는 클래스명(또는 JAR 파일명) 이후에 전달되는 모든 인자를 **애플리케이션 인자**로 처리합니다. 즉, 그 앞에 오는 것만 JVM 인자로 처리합니다.

현재 문제가 되는 명령어는 다음과 같습니다:
```
java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m spring-webapp.jar

💡 Result:

네. 저 명령은 JVM 옵션을 “무시”하는 게 아니라, -jar 뒤는 JVM 옵션 파싱 구간이 끝난 상태라서 그렇게 동작합니다.

  • java -jar <jarfile> [args...]에서 **-jar 다음 토큰(첫 번째 non-option 인자)**이 무조건 JAR 파일로 해석됩니다. 그리고 그 뒤에 오는 모든 인자는 전부 애플리케이션(main) 인자로 전달됩니다. [1][2]
  • 따라서 아래 명령은:
    java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m spring-webapp.jar
    jarfile-Dspring.profiles.active=prod로 잡히고, -Xms256m -Xmx256m spring-webapp.jar는 애플리케이션 인자로 넘어가는 형태가 됩니다(결과적으로 정상 실행이 어렵거나 “Unable to access jarfile …”류 에러가 날 가능성이 큼). [1][2]

올바른 형태(예시):

java -Dspring.profiles.active=prod -Xms256m -Xmx256m -jar spring-webapp.jar

(요약: JVM 옵션은 -jar 및 JAR 파일명 에만 둘 수 있습니다.) [1][2]

출처

  • [1] Oracle Java launcher java 문서 (java command man page)
  • [2] OpenJDK java man page (synopsis: java [options] -jar file.jar [args...], jar/class 뒤는 args로 전달)

@rlagkswn00 검색 결과를 확인하니 생각보다 더 심각한 문제였습니다.

Java 런처는 -jar 바로 다음에 오는 첫 번째 토큰을 무조건 JAR 파일 경로로 해석합니다. 즉, 아래 명령어에서:

java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m spring-webapp.jar

-Dspring.profiles.active=prod가 JAR 파일 경로로 잡히고, -Xms256m -Xmx256m spring-webapp.jar는 애플리케이션 인자로 넘어갑니다. 이 경우 "Unable to access jarfile …" 류의 오류가 발생하거나 정상 실행이 어려웠을 가능성이 큽니다.

즉, 이전부터 이미 배포 스크립트가 잘못된 상태였다는 뜻입니다. (앱이 실제로 실행되고 있었다면, JVM 구현체가 관대하게 처리해줬을 수도 있지만, 표준 동작은 아닙니다.)

이번 PR에서 반드시 함께 수정하시는 것을 권장드립니다:

-nohup java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE > "$APP_LOG" 2>&1 < /dev/null &
+nohup java -Dspring.profiles.active=prod -Xms256m -Xmx256m -jar "$JAR_FILE" > "$APP_LOG" 2>&1 < /dev/null &

올바른 형태는 JVM 옵션을 -jar 및 JAR 파일명 앞에만 위치시키는 것입니다: java [options] -jar file.jar [args...]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Checked on prod: the service is currently running with the same command shape (java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m ...) and the deployed bundle predates this PR, so this does not appear to be a regression introduced here. Reordering to the canonical java [options] -jar file.jar form could still be considered as a readability/portability cleanup, but I do not think this is a critical issue for this PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@rlagkswn00, thank you for verifying this on production — that's valuable evidence.

Looking at this more carefully, I overstated the severity. The Java launcher scans the full argument list for recognized JVM option prefixes (-D, -X, -XX, etc.) even when they appear after -jar and before the JAR filename. Since -Dspring.profiles.active=prod, -Xms256m, and -Xmx256m all carry recognized JVM option prefixes, HotSpot's launcher correctly identifies spring-webapp.jar as the first non-option argument following -jar and applies the JVM flags as intended. Your production verification confirms this: the service runs and the options are applied.

The argument for reordering to java [options] -jar file.jar is purely one of readability and portability — it matches the canonical synopsis documented by Oracle and makes the intent unambiguous to human readers and any future tooling that might parse the command. It is not a functional regression fix.

I'll defer to your judgment on whether to include that cleanup in this PR or a future one. Downgrading the severity of this comment from critical.


✏️ Learnings added
Learnt from: rlagkswn00
Repo: ku-ring/ku-ring-backend-web PR: 370
File: scripts/start.sh:22-22
Timestamp: 2026-04-04T12:50:32.668Z
Learning: In the ku-ring-backend-web repository, `scripts/start.sh` uses the command form `java -jar -Dspring.profiles.active=prod -Xms256m -Xmx256m $JAR_FILE`. This is non-canonical (canonical: `java [options] -jar file.jar`) but works correctly on HotSpot because the launcher recognizes `-D`, `-Xms`, `-Xmx` as JVM option prefixes even when listed between `-jar` and the JAR filename. Production has confirmed the service runs correctly with this form. Reordering is a readability/portability cleanup only, not a functional fix.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@rlagkswn00 rlagkswn00 merged commit 32a4b24 into main Apr 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 Deploy Production deploy production server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant