Report analysis hangs with ORA-03146

Hello,

We are using SonarQube 7.9.1 with Oracle 19c DB.
Recently we are seeing below error

Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: java.sql.SQLException: ORA-03146: invalid buffer length for TTC field

### The error may exist in org.sonar.db.source.FileSourceMapper
### The error may involve org.sonar.db.source.FileSourceMapper.update-Inline
### The error occurred while setting parameters
### SQL: update       file_sources     set       updated_at = ?,       binary_data = ?,       line_hashes = ?,       line_hashes_version = ?,       line_count = ?,       data_hash = ?,       src_hash = ?,       revision = ?     where       id = ?
### Cause: java.sql.SQLException: ORA-03146: invalid buffer length for TTC field

        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:67)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
        at com.sun.proxy.$Proxy46.update(Unknown Source)
        at org.sonar.db.source.FileSourceDao.update(FileSourceDao.java:118)
        at org.sonar.ce.task.projectanalysis.source.PersistFileSourcesStep$FileSourceVisitor.persistSource(PersistFileSourcesStep.java:147)
        at org.sonar.ce.task.projectanalysis.source.PersistFileSourcesStep$FileSourceVisitor.visitFile(PersistFileSourcesStep.java:100)
        ... 36 common frames omitted
Caused by: java.sql.SQLException: ORA-03146: invalid buffer length for TTC field

        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:509)
        at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:461)
        at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1104)
        at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:550)
        at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
        at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:655)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:270)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:91)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1205)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3666)

When this error occurs, SonarQube report analysis will hang and reports for other projects will be waiting.

we need to restart the SonarQube server for the hanged analysis to get canceled and for other analysis to continue (on SonarQube restart).

We are using using latest Oracle 19c JDBC driver and set below extra properties for CE server.

sonar.ce.javaAdditionalOpts=-Doracle.net.encryption_client=REQUIRED -Doracle.net.crypto_checksum_types_client="( SHA256 )" -Doracle.net.encryption_types_client="( AES256 )" -Doracle.net.crypto_checksum_client=REQUIRED

We observed that this issue happening to files with more lines like (5K-10K) and does not happen consistently.

Appreciate any feedback/guidance to resolve this issue.

With Regards,
Vara Prasad.

Hello @VaraPrasad ,

After digging into issue I found that this error seems to be an internal one of oracle (might worth asking them if you have support subscription):

ORA-03146: Invalid buffer length for TTC field
Cause: A corrupt Two-Task Common (TTC) packet was received.
Action: This is a internal protocol error. Contact Oracle Support Services.

Also you could try with different Oracle Driver version which is more mature like: 12.2.01.

Are you able to test those analysis with encryption disabled to see if that’s related?

2 Likes

@VaraPrasad, it seems, that the error you are experiencing is indeed a known bug in Oracle 19c database when blob objects are written via JDBC. You will need to get in touch with Oracle to get 30955880 patch for your database version to address this.

Best,
Michal

3 Likes

Thanks Jacek and Michal for the inputs.
We will evaluate the options suggested and get back to you on how it goes.

With Regards,
Vara Prasad.