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

Porter cannot start services, thinks they are already running #29

Open
manavo opened this issue Jul 6, 2023 · 8 comments
Open

Porter cannot start services, thinks they are already running #29

manavo opened this issue Jul 6, 2023 · 8 comments

Comments

@manavo
Copy link

manavo commented Jul 6, 2023

I'm having an issue where the services aren't running, Porter thinks they aren't running, but then can't start them because it thinks they are running.

manavo@MacBook-Pro ~ % porter status

 Porter must be running to use this command. Do you want to start Porter? (yes/no) [yes]:
 > yes


In SupervisordRepository.php line 120:
                                 
  Services are already running.  

Not sure if there are any other debug things that would be useful? In the ~/.porter directory this is what I see:

manavo@MacBook-Pro .porter % ls -la
total 56
drwx------   9 manavo  staff   288 12 Jun 14:32 .
drwxr-xr-x+ 76 manavo  staff  2432  6 Jul 16:07 ..
-rw-r--r--   1 manavo  staff    95 26 May 10:39 apps.json
-rw-r--r--   1 manavo  staff   213 26 May 10:33 file-watcher.js
drwx------   2 manavo  staff    64 28 Jun 11:51 logs
srwx------   1 manavo  staff     0 12 Jun 14:32 supervisor.sock
-rw-r--r--   1 manavo  staff  2695  6 Jul 16:08 supervisord.conf
-rw-r--r--   1 manavo  staff  8902 18 Jun 13:41 supervisord.log
-rw-r--r--   1 manavo  staff     6 12 Jun 14:32 supervisord.pid

Not sure if maybe a pid/sock file is somehow leftover, and it's confusing things thinking they are running?

Last note, this is using Porter v0.0.11

@manavo
Copy link
Author

manavo commented Jul 6, 2023

Dug into this a little bit, and it seems like that was the case, the .pid file was leftover.

So after running this, it's been able to start the services again:

manavo@MacBook-Pro ~ % mv .porter/supervisord.pid .porter/supervisord.pid.bak
manavo@MacBook-Pro ~ % porter start
Starting services: loading...Unlinking stale socket /Users/manavo/.porter/supervisor.sock
Starting services: ✔

Not sure what caused the .pid file to get left behind though 😕

@beNjiox
Copy link

beNjiox commented Jul 10, 2023

Thanks @manavo - just ran into this issue as well, and your tip worked for me.

@Cipfahim
Copy link

Thank you @manavo it worked :) Any idea why this happened?

@manavo
Copy link
Author

manavo commented Aug 26, 2023

Not sure, I'm guessing something crashes and the file gets left behind? It hasn't happened to me again, but glad this worked for you!

@squatto
Copy link
Contributor

squatto commented Oct 25, 2023

Rather than having to manually delete the supervisord.pid file, you can instead run this command to have Porter delete it for you:

porter stop --force

For reference...

The stop command calls SupervisordRepository->stopSupervisord() with the force option:

$this->task('Stopping services', function () use ($repository) {
return $repository->stopSupervisord($this->option('force'));
});

SupervisordRepository->stopSupervisord() deletes the supervisord.pid file when the force option is provided:

if($force) {
Storage::delete('supervisord.pid');
}

@manavo
Copy link
Author

manavo commented Oct 26, 2023

Well spotted @squatto! Definitely a better option!

@justRau
Copy link

justRau commented Dec 13, 2023

Encountered the same issue when porter was running and did a system reboot.

@RobertCordes
Copy link

Just had the same issue. Thank @squatto for mentioning the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants