Skip to content

[APIS-1103] Fix null error messages when several threads hit the first error at the same time - #86

Merged
Srltas merged 1 commit into
CUBRID:developfrom
Srltas:APIS-1103
Aug 20, 2026
Merged

[APIS-1103] Fix null error messages when several threads hit the first error at the same time#86
Srltas merged 1 commit into
CUBRID:developfrom
Srltas:APIS-1103

Conversation

@Srltas

@Srltas Srltas commented Aug 19, 2026

Copy link
Copy Markdown
Member

http://jira.cubrid.org/browse/APIS-1103

Purpose

CUBRIDJDBCErrorCode.getMessage()가 메시지 테이블을 스레드 안전하지 않게 지연 초기화합니다. 그로 인해서 여러 스레드가 동시에 첫 호출을 하면 일부가 아직 비어 있는 테이블을 조회해 null을 받게 됩니다.

지연 초기화를 직접 락을 걸어 방어하는 대신, JVM이 이미 락으로 보호하고 정확히 한 번만 실행하는 클래스 초기화로 옮겼습니다. 조회 경로에는 락이 남지 않으므로 Hashtable의 메서드 단위 동기화도 함께 제거합니다.

Implementation

항목 이전 이후
초기화 방식 getMessage() 안에서 지연 초기화, 보호 없음 클래스 초기화에서 1회, JVM 클래스 초기화 락
자료구조 Hashtable (조회마다 락) HashMap (락 없음)
불변성 없음 final + Collections.unmodifiableMap

Remarks

N/A

@Srltas Srltas self-assigned this Aug 19, 2026
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown

Reviews (1): Last reviewed commit: "fix: initialize JDBC error message table..." | Re-trigger Greptile

@Srltas
Srltas requested a review from hwany7seo August 19, 2026 23:05
@Srltas
Srltas merged commit becb272 into CUBRID:develop Aug 20, 2026
4 checks passed
@Srltas
Srltas deleted the APIS-1103 branch August 20, 2026 00:16
cubrid-submodule-bot Bot pushed a commit to CUBRID/cubrid that referenced this pull request Aug 20, 2026
51152ed -> becb272 (2 commit(s))
CUBRID/cubrid-jdbc@51152ed...becb272

- [APIS-1105] Add PULL_REQUEST_TEMPLATE.md (CUBRID/cubrid-jdbc#87)
  http://jira.cubrid.org/browse/APIS-1105

- [APIS-1103] Fix null error messages when several threads hit the first error at the same time (CUBRID/cubrid-jdbc#86)
  http://jira.cubrid.org/browse/APIS-1103
cubrid-submodule-bot Bot pushed a commit to CUBRID/cubrid that referenced this pull request Aug 21, 2026
51152ed -> becb272 (2 commit(s))
CUBRID/cubrid-jdbc@51152ed...becb272

- [APIS-1105] Add PULL_REQUEST_TEMPLATE.md (CUBRID/cubrid-jdbc#87)
  http://jira.cubrid.org/browse/APIS-1105

- [APIS-1103] Fix null error messages when several threads hit the first error at the same time (CUBRID/cubrid-jdbc#86)
  http://jira.cubrid.org/browse/APIS-1103
cubrid-submodule-bot Bot pushed a commit to CUBRID/cubrid that referenced this pull request Aug 22, 2026
51152ed -> becb272 (2 commit(s))
CUBRID/cubrid-jdbc@51152ed...becb272

- [APIS-1105] Add PULL_REQUEST_TEMPLATE.md (CUBRID/cubrid-jdbc#87)
  http://jira.cubrid.org/browse/APIS-1105

- [APIS-1103] Fix null error messages when several threads hit the first error at the same time (CUBRID/cubrid-jdbc#86)
  http://jira.cubrid.org/browse/APIS-1103
Srltas added a commit to CUBRID/cubrid that referenced this pull request Aug 22, 2026
51152ed -> becb272 (2 commit(s))
CUBRID/cubrid-jdbc@51152ed...becb272

- [APIS-1105] Add PULL_REQUEST_TEMPLATE.md (CUBRID/cubrid-jdbc#87)
  http://jira.cubrid.org/browse/APIS-1105

- [APIS-1103] Fix null error messages when several threads hit the first error at the same time (CUBRID/cubrid-jdbc#86)
  http://jira.cubrid.org/browse/APIS-1103

Co-authored-by: Srltas <49967405+Srltas@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants