Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GreengrassCliSteps): local redeploy of the same component failed on Windows #213

Open
bgklika opened this issue Jul 4, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bgklika
Copy link
Contributor

bgklika commented Jul 4, 2023

Describe the bug
When we do local deploy of component already installed (at least in case of plugin) Nucleus is failed.

Priority
local redeploy is used as workaround for missing configuration update better to apply forces to issue 210

To Reproduce

  1. Do deployment with Bridge component from backend
  2. Do installation of Bridge component from local store with updated configuration

Expected behavior
Deployment will successful

Actual behavior
Deployment failed with error:

2023-07-04T17:24:44.925Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentService: Received deployment in the queue. {DeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, GreengrassDeploymentId=null, DeploymentType=LOCAL, serviceName=DeploymentService, currentState=RUNNING}
2023-07-04T17:24:44.925Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentService: Received deployment document in queue. {document={"requestId":"699406e7-5b82-4aa0-9935-81fad7742862","requestTimestamp":1688491483952,"componentsToMerge":{"aws.greengrass.clientdevices.mqtt.Bridge":"2.2.6"},"componentsToRemove":null,"groupName":null,"requiredCapabilities":null,"componentNameToConfig":null,"configurationUpdate":{"aws.greengrass.clientdevices.mqtt.Bridge":{"MERGE":{"mqttTopicMapping":{"mapping1:":{"topic":"gg-d42b4b81baf9cc0d20ce-localMqttSubscribertopic/to/localmqtt","source":"IotCore","target":"LocalMqtt"}}},"RESET":null}},"componentToRunWithInfo":null,"recipeDirectoryPath":"C:\\Users\\ggc_user\\AppData\\Local\\Temp\\gg-testing-2629919704012159734\\gg-d42b4b81baf9cc0d20ce\\testlocalstore\\recipes","artifactsDirectoryPath":"C:\\Users\\ggc_user\\AppData\\Local\\Temp\\gg-testing-2629919704012159734\\gg-d42b4b81baf9cc0d20ce\\testlocalstore\\artifacts","failureHandlingPolicy":null}, serviceName=DeploymentService, currentState=RUNNING}
2023-07-04T17:24:44.944Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentStatusKeeper: Stored deployment status. {DeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, GreengrassDeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, DeploymentStatus=IN_PROGRESS}
2023-07-04T17:24:44.948Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentDirectoryManager: Create work directory for new deployment. {deploymentId=699406e7-5b82-4aa0-9935-81fad7742862, link=C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\deployments\ongoing, directory=C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\deployments\699406e7-5b82-4aa0-9935-81fad7742862}
2023-07-04T17:24:44.950Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentDirectoryManager: Persist deployment metadata. {file=C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\deployments\699406e7-5b82-4aa0-9935-81fad7742862\deployment_metadata.json, deploymentId=699406e7-5b82-4aa0-9935-81fad7742862}
2023-07-04T17:24:44.962Z [ERROR] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentService: Error copying recipes and artifacts. {serviceName=DeploymentService, currentState=RUNNING}
java.io.IOException: Unable to copy artifacts from  C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\testlocalstore\artifacts due to: C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\packages\artifacts\aws.greengrass.clientdevices.mqtt.Bridge\2.2.6\aws.greengrass.clientdevices.mqtt.Bridge.jar: The process cannot access the file because it is being used by another process.
	at com.aws.greengrass.deployment.DeploymentService.copyRecipesAndArtifacts(DeploymentService.java:771)
	at com.aws.greengrass.deployment.DeploymentService.createNewDeployment(DeploymentService.java:616)
	at com.aws.greengrass.deployment.DeploymentService.startup(DeploymentService.java:286)
	at com.aws.greengrass.lifecyclemanager.Lifecycle.lambda$handleStateTransitionStartingToRunningAsync$9(Lifecycle.java:591)
	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:834)
Caused by: java.nio.file.FileSystemException: C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\packages\artifacts\aws.greengrass.clientdevices.mqtt.Bridge\2.2.6\aws.greengrass.clientdevices.mqtt.Bridge.jar: The process cannot access the file because it is being used by another process.
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:164)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:283)
	at java.base/java.nio.file.Files.copy(Files.java:1295)
	at com.aws.greengrass.util.Utils$1.visitFile(Utils.java:719)
	at com.aws.greengrass.util.Utils$1.visitFile(Utils.java:709)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2725)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
	at com.aws.greengrass.util.Utils.copyFolderRecursively(Utils.java:709)
	at com.aws.greengrass.deployment.DeploymentService.copyRecipesAndArtifacts(DeploymentService.java:747)
	... 8 more
2023-07-04T17:24:45.753Z [INFO] (AwsEventLoop 1) software.amazon.awssdk.eventstreamrpc.RpcServer: New connection immediately closed. {}
2023-07-04T17:24:45.968Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentService: Current deployment finished. {DeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, GreengrassDeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, serviceName=DeploymentService, currentState=RUNNING}
2023-07-04T17:24:45.972Z [ERROR] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentService: Deployment task failed with following errors. {DeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, detailed-deployment-status=FAILED_NO_STATE_CHANGE, deployment-error-types=[DEVICE_ERROR], GreengrassDeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, serviceName=DeploymentService, currentState=RUNNING, deployment-error-stack=[DEPLOYMENT_FAILURE, IO_ERROR, IO_WRITE_ERROR]}
com.aws.greengrass.deployment.exceptions.DeploymentException: Error copying recipes and artifacts
	at com.aws.greengrass.deployment.DeploymentService.createNewDeployment(DeploymentService.java:624)
	at com.aws.greengrass.deployment.DeploymentService.startup(DeploymentService.java:286)
	at com.aws.greengrass.lifecyclemanager.Lifecycle.lambda$handleStateTransitionStartingToRunningAsync$9(Lifecycle.java:591)
	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:834)
Caused by: java.io.IOException: Unable to copy artifacts from  C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\testlocalstore\artifacts due to: C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\packages\artifacts\aws.greengrass.clientdevices.mqtt.Bridge\2.2.6\aws.greengrass.clientdevices.mqtt.Bridge.jar: The process cannot access the file because it is being used by another process.
	at com.aws.greengrass.deployment.DeploymentService.copyRecipesAndArtifacts(DeploymentService.java:771)
	at com.aws.greengrass.deployment.DeploymentService.createNewDeployment(DeploymentService.java:616)
	... 7 more
Caused by: java.nio.file.FileSystemException: C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\packages\artifacts\aws.greengrass.clientdevices.mqtt.Bridge\2.2.6\aws.greengrass.clientdevices.mqtt.Bridge.jar: The process cannot access the file because it is being used by another process.
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileCopy.copy(WindowsFileCopy.java:164)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.copy(WindowsFileSystemProvider.java:283)
	at java.base/java.nio.file.Files.copy(Files.java:1295)
	at com.aws.greengrass.util.Utils$1.visitFile(Utils.java:719)
	at com.aws.greengrass.util.Utils$1.visitFile(Utils.java:709)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2725)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2797)
	at com.aws.greengrass.util.Utils.copyFolderRecursively(Utils.java:709)
	at com.aws.greengrass.deployment.DeploymentService.copyRecipesAndArtifacts(DeploymentService.java:747)
	... 8 more
2023-07-04T17:24:45.977Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentStatusKeeper: Stored deployment status. {DeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, GreengrassDeploymentId=699406e7-5b82-4aa0-9935-81fad7742862, DeploymentStatus=FAILED}
2023-07-04T17:24:45.977Z [INFO] (pool-2-thread-14) com.aws.greengrass.status.FleetStatusService: fss-status-update-published. Status update published to FSS. {trigger=LOCAL_DEPLOYMENT, serviceName=FleetStatusService, currentState=RUNNING}
2023-07-04T17:24:45.977Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentDirectoryManager: Persist link to last deployment. {link=C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\deployments\previous-failure}
2023-07-04T17:24:45.977Z [INFO] (pool-2-thread-14) com.aws.greengrass.deployment.DeploymentDirectoryManager: Clean up link to earlier deployment. {link=C:\Users\ggc_user\AppData\Local\Temp\gg-testing-2629919704012159734\gg-d42b4b81baf9cc0d20ce\deployments\previous-success}

Environment

  • OS: Windows 11
  • JDK version: JDK11
  • Nucleus version: 2.11.0

Additional context
I think it related to Windows file locking for Greengrass plugins. We try to overwrite file which is locked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant