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

fix: check if unix socket is in use #224

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Conversation

mkenigs
Copy link
Contributor

@mkenigs mkenigs commented Aug 15, 2024

Currently, if two instances of process-compose are started with the same unix socket, the first instance is orphaned without any way to shut it down:

> process-compose up -u /tmp/sock --tui=false >/dev/null 2>&1 &
[1] 52138

> process-compose up -u /tmp/sock --tui=false >/dev/null 2>&1 &
[2] 52217

> process-compose down -u /tmp/sock
[2]  + done       process-compose up -u /tmp/sock --tui=false > /dev/null 2>&1

> process-compose down -u /tmp/sock
24-08-07 11:59:19.436 FTL failed to stop project error="Post \"http://unix/project/stop/\": dial unix /tmp/sock: connect: no such file or directory"

> pgrep process-compose
52138

Instead of unconditionally removing an existing unix socket, error if it is already in use.

Currently, if two instances of process-compose are started with the same
unix socket, the first instance is orphaned without any way to shut it
down:

```
> process-compose up -u /tmp/sock --tui=false >/dev/null 2>&1 &
[1] 52138

> process-compose up -u /tmp/sock --tui=false >/dev/null 2>&1 &
[2] 52217

> process-compose down -u /tmp/sock
[2]  + done       process-compose up -u /tmp/sock --tui=false > /dev/null 2>&1

> process-compose down -u /tmp/sock
24-08-07 11:59:19.436 FTL failed to stop project error="Post \"http://unix/project/stop/\": dial unix /tmp/sock: connect: no such file or directory"

> pgrep process-compose
52138
```

Instead of unconditionally removing an existing unix socket, error if it
is already in use.
Copy link

Copy link
Owner

@F1bonacc1 F1bonacc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@F1bonacc1 F1bonacc1 merged commit 14b33bc into F1bonacc1:main Aug 15, 2024
1 check passed
@mkenigs mkenigs deleted the check-socket branch August 15, 2024 20:25
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

Successfully merging this pull request may close these issues.

2 participants