You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We observed a duplicate entry issue during the database insertion while creating a new version of an API. When we are clicking the "Create" button more than once during this process, it leads to duplicate entries and deadlocks. Please find the relevant logs below
[2024-10-08 20:20:04,625] ERROR - GlobalThrowableMapper Error while persisting API
[2024-10-08 20:20:05,247] ERROR - GlobalThrowableMapper Failed to get API
[2024-10-08 20:20:05,704] **ERROR - ApiMgtDAO Error while adding the API: admin-Namal-v5 to the database
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin-Namal-v5-carbon.super' for key 'am_api.API_PROVIDER**'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_412-internal]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_412-internal]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_412-internal]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_412-internal]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:403) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.Util.getInstance(Util.java:386) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1915) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1254) ~[mysql-connector-java-5.1.49.jar:5.1.49]
at sun.reflect.GeneratedMethodAccessor252.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_412-internal]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_412-internal]
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118) ~[jdbc-pool_9.0.58.wso2v1.jar:?]
at com.sun.proxy.$Proxy51.execute(Unknown Source) ~[?:?]
at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.addAPI_aroundBody232(ApiMgtDAO.java:5361) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.addAPI(ApiMgtDAO.java:5316) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI_aroundBody32(APIProviderImpl.java:766) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:765) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI_aroundBody30(APIProviderImpl.java:719) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:658) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI_aroundBody0(UserAwareAPIProvider.java:77) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI(UserAwareAPIProvider.java:76) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.createNewAPIVersion_aroundBody138(APIProviderImpl.java:3128) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.createNewAPIVersion(APIProviderImpl.java:3090) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.createNewAPIVersion(UserAwareAPIProvider.java:1) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.createNewAPIVersion(ApisApiServiceImpl.java:3820) ~[?:?]
at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.createNewAPIVersion(ApisApi.java:357) ~[?:?]
at sun.reflect.GeneratedMethodAccessor637.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_412-internal]
.
.
.
[2024-10-08 20:20:04,621] ERROR - GovernanceArtifactImpl Error in associating lifecycle for the artifact. id: b10d8988-3eba-4e75-b566-de10bfb3b67f, path: /apimgt/applicationdata/provider/admin/Namal/v5/api.
**org.wso2.carbon.registry.core.exceptions.RegistryException: Unable to put resource Failed to delete the resource with id 1658. Deadlock found when trying to get lock; try restarting transaction**
at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.put(MountHandler.java:299) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.put(HandlerManager.java:2505) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.put(UserDefinedHandlerManager.java:204) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.put(HandlerLifecycleManager.java:950) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.put(EmbeddedRegistry.java:705) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.associateAspect(EmbeddedRegistry.java:2490) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.associateAspect(CacheBackedRegistry.java:499) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.associateAspectInternal(UserRegistry.java:1913) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry.access$3800(UserRegistry.java:73) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry$39.run(UserRegistry.java:1885) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.session.UserRegistry$39.run(UserRegistry.java:1882) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_412-internal]
at org.wso2.carbon.registry.core.session.UserRegistry.associateAspect(UserRegistry.java:1882) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.attachLifecycle(GovernanceArtifactImpl.java:383) ~[org.wso2.carbon.governance.api_4.8.28.jar:?]
at org.wso2.carbon.apimgt.persistence.RegistryPersistenceImpl.addAPI(RegistryPersistenceImpl.java:194) ~[org.wso2.carbon.apimgt.persistence_9.20.74.274.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI_aroundBody30(APIProviderImpl.java:706) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.addAPI(APIProviderImpl.java:658) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI_aroundBody0(UserAwareAPIProvider.java:77) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.addAPI(UserAwareAPIProvider.java:76) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.createNewAPIVersion_aroundBody138(APIProviderImpl.java:3128) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.APIProviderImpl.createNewAPIVersion(APIProviderImpl.java:3090) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.createNewAPIVersion(UserAwareAPIProvider.java:1) ~[org.wso2.carbon.apimgt.impl_9.20.74.292.jar:?]
at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.createNewAPIVersion(ApisApiServiceImpl.java:3820) ~[?:?]
at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.createNewAPIVersion(ApisApi.java:357) ~[?:?]
at sun.reflect.GeneratedMethodAccessor637.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_412-internal]
.
.
.
**Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to delete the resource with id 1658. Deadlock found when trying to get lock; try restarting transaction**
at org.wso2.carbon.registry.core.jdbc.dao.JDBCResourceDAO.deleteResource(JDBCResourceDAO.java:1561) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.Repository.removeResource(Repository.java:615) ~[org.wso2.carbon.registry.core_4.6.3.23.jar:?]
at org.wso2.carbon.registry.core.jdbc.Repository.prepareUpdate(Repository.java:362) ~
.
.
.
To prevent this from happening in the future, I believe we can disable the "Create" button after one click, similar to the initial API creation process, to avoid multiple clicks during the version creation.
Regards,
Rizmeer
Steps to Reproduce
Create an API.
Navigate to the new version creation section of the specific API.
Complete the required details for creating a new version of the specific API.
Click the "Create" button multiple times.
Affected Component
APIM
Version
4.1.0
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response
The text was updated successfully, but these errors were encountered:
This proposed solution is related to the FE implementation. What will happen if CLI or API oriented client does a similar (duplicated operation) within the same time frame?
Description
Hi Team,
We observed a duplicate entry issue during the database insertion while creating a new version of an API. When we are clicking the "Create" button more than once during this process, it leads to duplicate entries and deadlocks. Please find the relevant logs below
To prevent this from happening in the future, I believe we can disable the "Create" button after one click, similar to the initial API creation process, to avoid multiple clicks during the version creation.
Regards,
Rizmeer
Steps to Reproduce
Affected Component
APIM
Version
4.1.0
Environment Details (with versions)
No response
Relevant Log Output
No response
Related Issues
No response
Suggested Labels
No response
The text was updated successfully, but these errors were encountered: