fix: prevent Oracle view crash and connection hang#569
Merged
Conversation
Three root causes fixed:
1. Query serialization (OracleConnection.swift)
OracleNIO doesn't support concurrent queries on a single connection.
Add QueryGate actor to serialize all executeQuery calls, preventing
state-machine corruption when fetchColumns/fetchForeignKeys run in
parallel with the main query.
2. Remove DBMS_METADATA.GET_DDL (OraclePlugin.swift)
GET_DDL with wrong object type (e.g. 'TABLE' for a materialized view)
triggers ORA-31603, which corrupts OracleNIO's channel handler state.
Build DDL manually from column info instead.
3. Remove DATA_DEFAULT from column queries (OraclePlugin.swift)
DATA_DEFAULT in ALL_TAB_COLUMNS is LONG type. OracleNIO crashes when
decoding non-NULL LONG values. Also use DBMS_METADATA.GET_DDL('VIEW')
for fetchViewDefinition, and add view fallback in fetchTableMetadata.
Note: OracleNIO 1.0.0-rc.4 has a force-unwrap bug at
OracleChannelHandler.swift:441 (self.rowStream!) that requires a
library-level patch — tracked separately for upstream fix.
d3122f1 to
04862f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #568. Fixes the remaining crash/hang issues from #564 — opening Oracle views caused crashes and subsequent connection hangs.
Three root causes:
Query serialization — OracleNIO doesn't support concurrent queries on a single connection.
fetchColumns+fetchForeignKeys+ main query all ran in parallel, corrupting the state machine. AddedQueryGateactor to serialize allexecuteQuerycalls.Remove
DBMS_METADATA.GET_DDL— calling it with wrong object type (e.g.'TABLE'for a materialized view) triggers ORA-31603, which corrupts OracleNIO's channel handler. Build DDL manually from column info instead.Avoid LONG columns —
DATA_DEFAULTinALL_TAB_COLUMNSandTEXTinALL_VIEWSare LONG type. OracleNIO crashes decoding non-NULL LONG values. RemovedDATA_DEFAULTfrom queries; useTEXT_VC(VARCHAR2) for view definitions.Note: OracleNIO 1.0.0-rc.4 has a force-unwrap bug (
self.rowStream!) that requires a library-level patch — tracked separately.Test plan
gvenzl/oracle-free, user=system)