Confluence and Oracle fail with "Protocol Violation" and "Could not get clob value for col" errors
Symptoms
The upgrade or instance indexing fails.
Application logs throws the error message below:
XXXX-XX-XX 11:13:12,580 INFO [localhost-startStop-1] [confluence.upgrade.recovery.ConfluenceProgressMonitor] begin TABLE_DATA: [XXXXXXXXX]
XXXX-XX-XX 11:14:26,056 WARN [localhost-startStop-1] [confluence.upgrade.impl.DefaultUpgradeManager] beforeUpgrade Pre-upgrade recovery file generation failed: Problem with table "XXXXXXXXX": Could not get clob value for col #2
com.atlassian.confluence.upgrade.recovery.DbDumpException: Problem with table "XXXXXXXXX": Could not get clob value for col #X
.
.
Caused by: java.sql.SQLException: Protocol violation: [ 14, 118, ]
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:669)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:249)
at oracle.jdbc.driver.T4C8TTIClob.read(T4C8TTIClob.java:245)
at oracle.jdbc.driver.T4CConnection.getChars(T4CConnection.java:3901)
at oracle.sql.CLOB.getChars(CLOB.java:517)
The error above exemplify a failed upgrade.
Cause
This is caused due to a bug in the OJDBC 7 Oracle Driver version 12.1.0.1.0.
According to a customer who found this error and reported to us:
When reading clobs from AL32UTF8/UTF-8 database, the JDBC thin driver returns the error Protocol violation. Protocol Violation may occur when reading clobs from AL32UTF8 database during stress.
The issue is reported in unpublished Bug 17976703 PROTOCOL VIOLATION WITH JDBC 12C DRIVER READING CLOBS
FROM AL32UTF8 D/B.
Resolution
There are 3 actions that can be taken to avoid this bug:
1) Use the JDBC driver version 12.1.0.2.0 which seems to fix this bug
2) Install the patch provided in the Oracle support page. (this is only available to customers with a valid Oracle support license). Download and apply Patch 17976703 from Support Portal ->Patches & Updates Section.
3) Switch back to the OJDBC 6 driver which doesn't have this bug.