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

[Bug] 서버 배포 관련 issue #109

Closed
yoontaek0928 opened this issue Jun 5, 2021 · 2 comments
Closed

[Bug] 서버 배포 관련 issue #109

yoontaek0928 opened this issue Jun 5, 2021 · 2 comments
Assignees
Labels
bug Something isn't working Server

Comments

@yoontaek0928
Copy link
Collaborator

Describe the bug(버그 내용)
인스턴스에서 서버 실행 시 메모리 부족 현상

  1. --max-old-space-size=4096 server/index.ts 로 메모리 할당 시도
  2. (node:1651) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. 라는 에러코드 발생
  3. package.json에 "type" : "module" 추가
  4. TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/ubuntu/the-GOD-server/server/index.ts 에러코드 발생
  5. 구글링 결과 package.json의 "type":"module"을 삭제 해야함. 맨 위로 반복
    To Reproduce(버그 재현 방법)
    가능한 자세히 버그 재현방법을 작성해 주세요
  6. 인스턴스 실행
  7. sudo yarn start
  8. 에러 발생

Screenshots(참고할 만한 자료를 첨부, 스크린샷, 코드, 에러 메시지)

  1. sudo yarn start 시

스크린샷 2021-06-05 오후 4 30 21

  1. 메모리 할당 시도

스크린샷 2021-06-05 오후 4 31 33

  1. package.json -> "type":"module" 추가 후

스크린샷 2021-06-05 오후 4 32 00

  1. 타입 에러

스크린샷 2021-06-05 오후 4 32 45

  1. 타입 에러 관련한 솔루션 링크
    ERR_UNKNOWN_FILE_EXTENSION after adding "type": "module" to package.json TypeStrong/ts-node#1171

결국 1번으로 돌아가게 됩니다.

++추가로

  1. 모듈 삭제 후 재설치
  2. 노드 nvm 등의 버전 확인
    등의 시도를 하였으나 변화가 없었습니다.

이 외에 다른 솔루션 방안으로 인스턴스 변경 , async 함수 최소화 등의 방법을 찾았습니다만 함수 변경은 불가능한 사항이라고 생각이 되며, 최후의 수단으로 인스턴스를 변경하는 것을 고려해보아야 한다고 생각합니다.
Additional context(수정할 방법을 제안할 수 있다면 작성해 주세요)

@yoontaek0928 yoontaek0928 added bug Something isn't working Server labels Jun 5, 2021
@yoontaek0928 yoontaek0928 self-assigned this Jun 5, 2021
@yoontaek0928
Copy link
Collaborator Author

+++추가로
각 커밋마다 확인해본 결과 첫 번째 PR인 보일러 플레이트부터, #48 까지는 컴파일 오류 제외하고 메모리에 부하가 걸리지 않지만, #49422ebac 커밋부터는 FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory 메시지가 나타나는 것을 확인할 수 있었습니다

@yoontaek0928
Copy link
Collaborator Author


다른 솔루션으로

  1. 인스턴스 유형 변경
  2. 비동기 함수 최소화

중, 2는 불가능하다고 판단하여 1의 방법으로 인스턴스 유형을 t2.micro -> t2.xlarge로 변경하여 해결하였습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Server
Projects
None yet
Development

No branches or pull requests

1 participant