aymen elo
aymen elo

Reputation: 11

What causes TerminateProcess: Access is denied. when trying to run a Symfony server on Windows?

Context

I am using Symfony for a website and I worked on it during around two weeks.

I'm on Windows 10, I use Symfony 5.8.12 and php 8.1.13 along with Wamp 3.3.0 for the database. Everything worked normally until last Friday :

I tried refreshing a page but the loading was endless. There were no additional symfony logs. I stopped the server from running using Ctrl+C and it stopped when looking at the processes in task manager. I got the message :

  TerminateProcess: Access is denied.                                   

I tried symfony server:start
I got the same message I again, but why ? I am trying to run it not terminate it.

Edit :I also discovered that Access is denied error I get is most likely because of the following, when running symfony server:status:
Server not running but Worker assigned to a non existent PID/Non symfony related PID

What I ended up doing as a temporary solution

Edit : I have admin rights now so it's not that big of a deal. I can logout then login again to solve the issue. The problem is it's happening several times on random days or times of the day.

The solution that worked was restarting the computer, but since I don't have my admin rights yet, I need the IT staff to enter admin credentials to execute Wamp.

I also tried using symfony server:start -d so that whenever I wanna stop the server I use the proper command, symfony server:stop.

What happened today and why I am posting on stackoverflow

Today, again I worked on my project for the day and everything went all good and my webpack compiled but the console in the dev tools didn't want to update my javascript code so I restarted symfony with symfony server:stop to which I get :

Stopping Web Server

Then I run symfony server:start and I get

TerminateProcess: Access is denied.

Questions

Edit - Why is the PID still assigned to a worker according to Symfony and is there a way to reset this "binding" without logging out ?
Why do I get this message about TerminateProcess when I am not terminating but starting the process ?
Why does this happen kind of randomly ? (it happened once directly after a reboot, today after a whole day working normally...).

Upvotes: 1

Views: 1571

Answers (2)

Toma
Toma

Reputation: 599

This cmd worked for me on symfony 7 and ps of windows 11:

symfony server:stop
symfony console cache:clear

and then start again, no need of rebooting.

Upvotes: 0

aymen elo
aymen elo

Reputation: 11

Thanks to CrSrr I found a way to "solve" this problem on the go (without having to logout/restart the computer) though it doesn't explain why, as shown in the OP's terminal screenshot, symfony keeps a Worker bound to the nonexistent PID.

I found an answer to a post that didn't specifically mention the TerminateProcess error, but that talked about symfony Workers being duplicated and bound to dead PIDs.

The solution is to delete the folder corresponding to the name of the log file mentioned after a server:status.

In our case the log file specified in Workers is 973a...1476.log.
And so we delete the folder C:\Users\%USER%\.symfony5\var\973a...1476\
We can then check its status, it should be as the following, and we can start our server again. symfony server:status result - Not Running and No Workers

Upvotes: 0

Related Questions