Unable to provision CloudFormation instances

While provisioning a CloudFormation instance, it may fail with an error message on the Morpheus UI.

"The security token included in the request is expired (Service: AmazonCloudFormation; Status Code: 403; Error Code: ExpiredToken; Request ID: 07146dc6-b406-43d0-9443-b29dc83e3964; Proxy: null)".

In the logs, the below exception can be seen followed by a Stack Trace:

2023-04-19_09:41:53.23803 'org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of reset command. Cannot lock /var/opt/morpheus/morpheus-local/repo/git/4d327bfa917e2cc076ec7fff41d44f78/.git/index. Ensure that no other process has an open file handle on the lock file /var/opt/morpheus/morpheus-local/repo/git/4d327bfa917e2cc076ec7fff41d44f78/.git/index.lock, then you may delete the lock file and retry.

This error message is related to the JGit library, which is a Java implementation of the Git version control system. This error message suggests that there is a problem with accessing the index file of a Git repository located at /var/opt/morpheus/morpheus-local/repo/git/4d327bfa917e2cc076ec7fff41d44f78/.git/index. It seems that the file is currently locked, meaning that another process may be using it. The error message advises to ensure that no other process has an open file handle on the lock file /var/opt/morpheus/morpheus-local/repo/git/4d327bfa917e2cc076ec7fff41d44f78/.git/index.lock, which is used to prevent multiple processes from modifying the index file at the same time.

To resolve this issue, you can try the following steps:

  1. Check if any other process is currently using the repository or the index file. If you are using a Unix-like system, you can use the lsof command to list all open files on the system and look for the lock file. On Windows, you can use the Process Explorer tool to find the process that is using the file.

  2. If you find any processes that are using the repository or the index file, you can try to kill or terminate them to release the lock on the file.

  3. If you are sure that no other process is using the repository or the index file, you can try to delete the lock file /var/opt/morpheus/morpheus-local/repo/git/4d327bfa917e2cc076ec7fff41d44f78/.git/index.lock. This will release the lock on the index file, and you can retry the operation that caused the error.

  4. If deleting the lock file does not resolve the issue, you can try to reset or repair the repository using Git commands like git reset or git fsck. This may help to fix any corrupted files or data structures in the repository.

Thanks
Deepti

1 Like