1 Commits

Author SHA1 Message Date
281dbb644b installer-pf: prevent app from dying on nat-upnp async errors
라우터가 UPnP 를 거부(ECONNREFUSED)하는 환경에서 nat-upnp 가 콜백 밖에서
비동기 소켓 오류를 내면 Electron 메인이 종료돼 창이 갑자기 닫히는("오류나면서
끝남") 현상이 생길 수 있다. v0.3.17 에서 CGNAT 판별용으로 externalIp() 를 항상
호출하게 되면서 이 경로가 새로 노출됨. process 전역 uncaughtException/
unhandledRejection 가드로 잡아 로그만 남기고 앱은 계속 살려 둔다(각 UPnP 호출은
타임아웃으로 진행되므로 멈추지 않음). v0.3.18.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
2026-07-05 22:32:20 +09:00
3 changed files with 12 additions and 1 deletions

View File

@@ -58,6 +58,7 @@
"closeTry": "UPnP 매핑 제거 시도: TCP {{port}}",
"upnpRemoveAttempt": "UPnP 매핑 제거 시도: {{message}}",
"upnpRemoveDone": "UPnP 매핑 제거 완료: TCP {{port}}",
"internalError": "내부 오류(무시하고 계속): {{message}}",
"upnpClientFail": "UPnP 클라이언트 생성 실패: {{message}}",
"portInUse": "포트 {{port}}이(가) 이미 사용 중 → 임시 리스너 없이 외부 서비스 응답만으로 판정.",
"listenerBindFail": "임시 리스너 바인딩 실패: {{message}}",

View File

@@ -1,6 +1,6 @@
{
"name": "minecraft-music-quiz-installer",
"version": "0.3.17",
"version": "0.3.18",
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
"main": "dist/installer/main.js",
"scripts": {

View File

@@ -38,6 +38,16 @@ function sendLog(line: string): void {
mainWindow.webContents.send('log', stamped)
}
// nat-upnp 는 라우터가 UPnP 를 거부/미지원할 때 콜백 밖에서 비동기 소켓 오류를
// 낼 수 있다. 처리되지 않으면 Electron 메인 프로세스가 그대로 종료되어 창이 갑자기
// 닫힌다("오류나면서 끝남"). 전역 가드로 잡아 로그만 남기고 앱은 계속 살려 둔다.
process.on('uncaughtException', (err) => {
try { sendLog(t('log.internalError', { message: (err as Error)?.message || String(err) })) } catch {}
})
process.on('unhandledRejection', (reason) => {
try { sendLog(t('log.internalError', { message: reason instanceof Error ? reason.message : String(reason) })) } catch {}
})
const sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))
/** 이 PC 의 LAN IPv4(사설 대역 우선). 수동 포워딩 대상 IP 안내에 쓴다. */