DVCS connector sync fails with error Bad value for type int : 2,147,525,356

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

DVCS Sync fails with an error 

1 2 3 4 5 6 7 8 9 10 Caused by: org.postgresql.util.PSQLException: Bad value for type int : 2,147,525,355 at org.postgresql.jdbc.PgResultSet.readLongValue(PgResultSet.java:3248) at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2183) at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215) at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215) at net.java.ao.types.IntegerType.pullFromDatabase(IntegerType.java:32) at net.java.ao.db.PostgreSQLDatabaseProvider.insertReturningKey(PostgreSQLDatabaseProvider.java:286) at net.java.ao.EntityManager.create(EntityManager.java:369) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:93) ... 354 more

Environment

7.13.x and later until 10.2.0 

Diagnosis

The logs may include stack traces similar to the ones below: 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 2022-05-06 15:16:09,570+0200 http-nio-8080-exec-4 ERROR xxxx 916x18975172x5 - xxxx /rest/bitbucket/1.0/repository/1795/sync [c.a.j.p.d.sync.impl.DefaultSynchronizer] There was a SQL exception thrown by the Active Objects library: Database: - name:PostgreSQL - version:12.6 - minor version:6 - major version:12 Driver: - name:PostgreSQL JDBC Driver - version:42.2.23 org.postgresql.util.PSQLException: Bad value for type int : 2,147,525,355 com.atlassian.activeobjects.internal.ActiveObjectsSqlException: There was a SQL exception thrown by the Active Objects library: Database: - name:PostgreSQL - version:12.6 - minor version:6 - major version:12 Driver: - name:PostgreSQL JDBC Driver - version:42.2.23 org.postgresql.util.PSQLException: Bad value for type int : 2,147,525,355 at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:95) at com.atlassian.activeobjects.osgi.TenantAwareActiveObjects.create(TenantAwareActiveObjects.java:267) at jdk.internal.reflect.GeneratedMethodAccessor488.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(Se
1 2 3 4 5 6 7 8 9 10 Caused by: org.postgresql.util.PSQLException: Bad value for type int : 2,147,525,355 at org.postgresql.jdbc.PgResultSet.readLongValue(PgResultSet.java:3248) at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2183) at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215) at org.apache.commons.dbcp2.DelegatingResultSet.getInt(DelegatingResultSet.java:215) at net.java.ao.types.IntegerType.pullFromDatabase(IntegerType.java:32) at net.java.ao.db.PostgreSQLDatabaseProvider.insertReturningKey(PostgreSQLDatabaseProvider.java:286) at net.java.ao.EntityManager.create(EntityManager.java:369) at com.atlassian.activeobjects.internal.EntityManagedActiveObjects.create(EntityManagedActiveObjects.java:93) ... 354 more

Run the below query to check the exact value for this table :

1 select * from "AO_E8B6CC_MESSAGE_TAG_ID_seq";

An improvement has been implemented in Jira 10.2.0 and later based on suggestion JSWSERVER-25929 - Better scaling for "AO_E8B6CC_MESSAGE_TAG" table

Cause

“AO_E8B6CC_MESSAGE_TAG”, which stores the sequence for ID, has gone over a range of ID primary key values. At the moment, the limit for this table's "ID" column is 2147483647 due to its INT data type. But due to the amount of operation that creates a new row in the table, the bigger the Repositories that are connected through DVCS, the ID will soon reach its limit, and the effect of this will be that DVCS Sync will not be possible.

Solution

Do try this in your test instance first to make sure there is no issue after running the query 

Currently, as a workaround, we propose to restart the sequence for “AO_E8B6CC_MESSAGE_TAG”.

Please run the below query:

1 2 3 4 5 6 7 8 9 BEGIN; LOCK TABLE "AO_E8B6CC_MESSAGE" IN ROW EXCLUSIVE MODE ; LOCK TABLE "AO_E8B6CC_MESSAGE_QUEUE_ITEM" in ROW EXCLUSIVE MODE; LOCK TABLE "AO_E8B6CC_MESSAGE_TAG" in ROW EXCLUSIVE MODE ; ALTER SEQUENCE "AO_E8B6CC_MESSAGE_TAG_ID_seq" RESTART; UPDATE "AO_E8B6CC_MESSAGE_TAG" SET "ID" = DEFAULT; COMMIT;

In case any problem/exception is thrown please execute:

1 ROLLBACK;

Updated on February 27, 2025

Still need help?

The Atlassian Community is here for you.