Repository navigation
Description
Problem
The Oracle driver never gets SO_KEEPALIVE or TCP_NODELAY on macOS or iOS, because the pinned oracle-nio fork only sets them on the socket path that Apple platforms never take.
Sources/OracleNIO/Connection/OracleConnection.swift at the pinned revision 23c7781:
static func makeBootstrap(
on eventLoop: EventLoop,
configuration: OracleConnection.Configuration
) -> NIOClientTCPBootstrapProtocol {
#if canImport(Network)
if let tsBootstrap =
NIOTSConnectionBootstrap(validatingGroup: eventLoop)
{
return
tsBootstrap
.connectTimeout(configuration.options.connectTimeout)
}
#endif
guard let bootstrap = ClientBootstrap(validatingGroup: eventLoop) else {
fatalError("No matching bootstrap found")
}
return
bootstrap
.connectTimeout(configuration.options.connectTimeout)
.channelOption(
ChannelOptions
.socket(SocketOptionLevel(SOL_SOCKET), SO_KEEPALIVE), value: 1
)
.channelOption(
ChannelOptions
.socket(SocketOptionLevel(IPPROTO_TCP), TCP_NODELAY), value: 1)
}The NIOTS branch returns after .connectTimeout only. Both options live on the ClientBootstrap fallback.
Apple platforms always take the NIOTS branch. In the same file, defaultEventLoopGroup returns NIOTSEventLoopGroup.singleton under #if canImport(Network), which is true on macOS as well as iOS, and NIOTSConnectionBootstrap(validatingGroup:) succeeds for that loop. OracleCoreConnection does not pass an event loop, so it inherits the default. So this affects the shipped Mac plugin too, not just mobile.
Effect
TCP_NODELAY is the one worth caring about. Oracle's TNS protocol is chatty with small messages, so Nagle coalescing adds latency to round trips. This is a performance issue, not a correctness one.
SO_KEEPALIVE matters less than it looks. TablePro already bounds detection at the application layer: OracleCoreConnection.ping() has its own 10 second deadline that closes the channel, and mapExecutionError marks the connection dead on any unrecognized transport failure (both added in #2034). OS-level keepalive would be a second, slower safety net.
Fix
Mirror the two .channelOption calls onto the NIOTSConnectionBootstrap branch. Both bootstrap types conform to NIOClientTCPBootstrapProtocol and accept .channelOption(_:value:).
Worth checking whether Network.framework already applies an equivalent of either option, since NWParameters.tcp has noDelay and enableKeepalive of its own, and setting BSD socket options on an NWConnection-backed channel may be a no-op. If so, the fix is to set them through NIOTSChannelOptions instead.
Where the change goes
TableProApp/oracle-nio has issues disabled, so this is tracked here. The work is: patch the fork on tablepro-main, then re-pin. Since #2034 the revision is pinned in one place, Packages/TableProOracle/Package.swift, rather than in both Xcode projects.
This most likely applies to upstream lovetodream/oracle-nio unchanged, so it is worth sending there too.
Activity
datlechin commentedon Aug 8, 2026
Correction to this issue: the TCP_NODELAY half is wrong.
NIOTSConnectionBootstrap.init?(validatingGroup:)already appendsTCP_NODELAYto itself, the same wayClientBootstrapdoes. Verified by connecting a real NIOTS channel to a live listener and reading the options back, which reportedTCP_NODELAY=1with no options set. So there was never any Nagle delay on Oracle's small protocol messages, and the explicitTCP_NODELAYcall in theClientBootstrapbranch is itself redundant.Keepalive was the real gap, and question 3 in the issue (whether Network.framework already covers this) turned out to be the important one.
Fixed in TableProApp/oracle-nio#8 and #2041.