VM template creation from vCD fails with the error 'ERROR: canceling statement due to lock timeout' due to the use of 'special characters'
search cancel

VM template creation from vCD fails with the error 'ERROR: canceling statement due to lock timeout' due to the use of 'special characters'

book

Article ID: 383011

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • This issue arises when special characters are used in the folder names, preventing folder creation in vCenter. As a result, vApp template and application image entries remain in the VMware Cloud Director catalog, which requires manual cleanup.
  • VM replication fails because the vApp template creation fails at the VCD level, and a blocking task to create the vApp template also fails.
  • Error logs from the customer environment show a consistent error during catalog item deletion:

| ERROR    | task-service-activity-pool-17292 | JDBCExceptionReporter          | Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* delete com.vmware.vcloud.common.model.VAppTemplateModel */ delete from catalog_item where id='########-####-####-####-#############'::uuid was aborted: ERROR: canceling statement due to lock timeout
  Where: while deleting tuple (11,3) in relation "catalog_item"  Call getNextException to see other errors in the batch. | requestId=########-####-####-####-#############
b,request=POST https://DNS/api/catalog/########-####-####-####-#############/action/captureVApp,requestTime=1724137296783,remoteAddress=X.X.X.X:
29331,userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ...,accept=application/*+xml;version 38.0 vcd=########-####-####-####-#############, task=ID
########-####-####-####-############# activity=(com.vmware.vcloud.backendbase.management.system.TaskActivity,urn:uuid:'########-####-####-####-#############
| ERROR    | task-service-activity-pool-17292 | JDBCExceptionReporter          | ERROR: canceling statement due to lock timeout
  Where: while deleting tuple (11,3) in relation "catalog_item" | requestId=########-####-####-####-#############,request=POST https://DNS/api/catalo
g/########-####-####-####-#############/action/captureVApp,requestTime=1724137296783,remoteAddress=IP-Address:29331,userAgent=Searchengine/X.0 (System)
 AppleWebKit/537.36 ...,accept=application/*+xml;version 38.0 vcd=########-####-####-####-#############,task=ID activity=(com.vmware.vc
loud.backendbase.management.system.TaskActivity,urn:uuid:########-####-####-####-#############)
| INFO     | task-service-activity-pool-17292 | Conversation                   | Transaction rolled back; session has been closed [Conversation:
 ########-####-####-####-#############, transaction null, transactionDepth: 0] Transaction opened at: 
current stack: java.lang.Exception
        at com.vmware.vcloud.common.persist.Conversation$1.getNewText(Conversation.java:98)
        at com.vmware.vcloud.logging.DecoratedLogger.info(DecoratedLogger.java:153)
        at com.vmware.vcloud.common.persist.Conversation.rollBackTransactionIfActive(Conversation.java:373)
        at com.vmware.cl.impl.LibraryItemServiceImpl.deleteLibraryItemAndBackingSync(LibraryItemServiceImpl.java:931)
        at com.vmware.vcloud.api.presentation.service.impl.VdcServiceAdapterImpl.abortTask(VdcServiceAdapterImpl.java:3366)
        at com.vmware.vcloud.backendbase.management.system.TaskActivity$TerminatePhase$1.doInSecurityContext(TaskActivity.java:563)
        at com.vmware.vcloud.backendbase.management.system.TaskActivity$TerminatePhase$1.doInSecurityContext(TaskActivity.java:560)
        at com.vmware.vcloud.backendbase.management.system.SecurityContextTemplate.executeForOrgAndUser(SecurityContextTemplate.java:49)
        at com.vmware.vcloud.backendbase.management.system.TaskActivity$TerminatePhase.invokeInner(TaskActivity.java:566)
        at com.vmware.vcloud.backendbase.management.system.TaskActivity$TaskActivityBasePhase.invoke(TaskActivity.java:361)
        at com.vmware.vcloud.activity.executors.ActivityRunner.runPhase(ActivityRunner.java:175)
        at com.vmware.vcloud.activity.executors.ActivityRunner.run(ActivityRunner.java:112)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

Environment

VMware Cloud Director 10.x

Cause

The root cause of this issue is the use of special characters in the folder names. When special characters are used, vApp template creation fails, and the process leaves behind unresolved entries in the catalog. The task to delete these entries fails due to a lock timeout error in the database, which prevents the cleanup process from completing successfully.

Resolution

Resolution:

  • This is a known issue within the VCD system. This issue is anticipated to be fixed in upcoming release of VCD (10.6.2).

Workaround:

Note: Before performing any delete operation in VCD, ensure that you take a full database backup and snapshots of the VCD cells.

1. Log into VMware Cloud Director

  • Use an administrator account to log in to the VMware Cloud Director web console.

2. Navigate to the Catalog

  • In the VCD web console, go to Catalogs. This is found under Resources in the left-hand navigation panel.

3. Select the Appropriate Catalog

  • Choose the catalog where the template entries you wish to clean up are located. If you are unsure of the catalog, check the available catalogs and their contents.

4. Identify the Templates to Clean Up

  • Browse through the catalog and identify the specific templates you want to remove or clean up.

5. Delete the Template Entries

  • Right-click on the template and select Delete.
  • Alternatively, select the template, and use the Delete button in the top toolbar.
  • Confirm the action when prompted. This will remove the entry from the catalog.

6. Verify Template Deletion

  • Once the template is deleted, ensure that it no longer appears in the catalog.
  • Refresh the catalog to double-check that the entry is completely removed.

Note: Deleting a template only removes the catalog entry; it does not delete the actual virtual machine or the template file from the underlying storage unless specified.