Details
Description
Summary
On the webhooks feature, if the webhook URL is longer than 255 characters, attempting to fire the webhook will cause exception errors from the database, and then fail to fire silently (no errors)
Bitbucket logs will show the following stack trace when a webhook with a long URL is being fired:
2018-02-08 16:31:16,346 WARN [threadpool:thread-8] c.a.b.i.w.d.AsyncInvocationHistoryDao Failed to write webhook invocation data for 1:pr:opened to the database com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:Oracle - version:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production - minor version:2 - major version:12 Driver: - name:Oracle JDBC driver - version:12.2.0.1.0 java.sql.SQLException: ORA-12899: value too large for column "BITBUCKET"."AO_371AEF_HIST_INVOCATION"."REQUEST_URL" (actual: 1024, maximum: 255) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:102) at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.create(TenantAwareActiveObjects.java:271) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) at com.atlassian.bitbucket.internal.webhook.dao.AoInvocationHistoryDao.saveInvocation(AoInvocationHistoryDao.java:285) at com.atlassian.bitbucket.internal.webhook.dao.AsyncInvocationHistoryDao.maybeFlush(AsyncInvocationHistoryDao.java:233) at com.atlassian.bitbucket.internal.webhook.dao.AsyncInvocationHistoryDao.flushPending(AsyncInvocationHistoryDao.java:220) at com.atlassian.bitbucket.internal.webhook.dao.AsyncInvocationHistoryDao.flush(AsyncInvocationHistoryDao.java:179) at com.atlassian.bitbucket.internal.webhook.dao.AsyncInvocationHistoryDao.flushAndReschedule(AsyncInvocationHistoryDao.java:208) at com.atlassian.stash.internal.concurrent.DefaultTransferableStateManager$StateTransferringRunnable.run(DefaultTransferableStateManager.java:166) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.lang.Thread.run(Thread.java:745) ... 17 frames trimmed Caused by: java.sql.SQLException: ORA-12899: value too large for column "BITBUCKET"."AO_371AEF_HIST_INVOCATION"."REQUEST_URL" (actual: 1024, maximum: 255) at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494) at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59) at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:910) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780) at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343) at oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3865) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3845) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) at net.java.ao.db.OracleDatabaseProvider.executeInsertReturningKey(OracleDatabaseProvider.java:297) at net.java.ao.DatabaseProvider.insertReturningKey(DatabaseProvider.java:1861) at net.java.ao.EntityManager.create(EntityManager.java:366) at net.java.ao.EntityManager.create(EntityManager.java:399) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:100) ... 19 common frames omitted Caused by: oracle.jdbc.OracleDatabaseException: ORA-12899: value too large for column "BITBUCKET"."AO_371AEF_HIST_INVOCATION"."REQUEST_URL" (actual: 1024, maximum: 255) at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498) ... 40 common frames omitted
Looking at the error, this issue looks to be caused by the fact that the 'REQUEST_URL' field in the 'AO_371AEF_HIST_INVOCATION' table has a VARCHAR2(255) datatype
Steps to Reproduce
- Create a webhook with a long URL (with more than 255 characters)
- Attempt to trigger the webhook (by pushing a commit, creating a pull request etc,)
Attachments
Issue Links
- causes
-
BSERV-11552 Webhook invocation history only records first 255 characters of request URL and result description
- Long Term Backlog