Ask Your Question

state file access error

asked 2016-01-05 09:42:15 -0500

jondoe gravatar image


We use puppet to deploy our applications. We have a minimalist setup with a puppet agent(v 3.7.1) running on a windows 2008 server and executing our deployment recipes. From time to time, I notice that we run into some weird errors, specifically, in the logs of the puppet run, I find the following:

Error: Failed to apply catalog: ReplaceFile(C:/ProgramData/PuppetLabs/puppet/var/state/state.yaml, C:/ProgramData/PuppetLabs/puppet/var/state/state.yaml20160105-6464-g5ug03): The process cannot access the file because it is being used by another process

This error occur AFTER the deployment is finished, so I am guessing the puppet agent is trying to update some internal file to keep track of what is has just done.

Also, our deployment process is run from a build factory, it is not unusual(it's actually pretty frequent) to have multiple jobs running at the same time(which translates into multiple puppet processes being run), can this be an issue ? i.e. Is puppet capable of handling simultaneous runs(our puppet jobs are just calls to "puppet apply")

Thanks and regards,


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-06 14:18:17 -0500

GregLarkin gravatar image

You will definitely have an issue if you try to run puppet apply simultaneously on the same machine. The Puppet agent (or apply command) only work in serial execution, and parallel execution is not supported and is actively prevented with puppet agent by use of a lock file.

So you can ignore those errors, I think, but it would be better to prevent parallel execution of puppet apply if possible.

You said you are using the puppet agent, too, so are you mixing the use of the agent and the apply command on the same machine? If so, I would simply use the agent service only, and you would avoid this issue altogether.

edit flag offensive delete link more


please check my answer for more details.

jondoe gravatar imagejondoe ( 2016-01-07 04:27:56 -0500 )edit

answered 2016-01-07 02:50:18 -0500

jondoe gravatar image

Thanks for your answer. When I say that we use an agent, I mean we have a standalone instance of puppet(no master-slave setup) and we run our recipes with a 'puppet apply'. We run our puppet recipes from a build factory, so it is hard to constrain the run to one at a time(technically, it is easy, but from a user perspective being constrained to running jobs sequential is really not acceptable) I am fine with puppet using a lock mechanism, but is it possible not to throw an error in case of concurent runs ? The reason being that our job are marked as a fail whereas in reality they finished properly.



edit flag offensive delete link more


I don't think there's any way to override the error message from Puppet. It's getting a low-level error from Windows and bubbling that up to the user. For all intents and purposes, that run is failing, even if the other one running in parallel succeeds. You might want to consider master/agent.

GregLarkin gravatar imageGregLarkin ( 2016-01-08 16:23:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-01-05 09:42:15 -0500

Seen: 102 times

Last updated: Jan 07 '16