Skip to content

dinitctl: dinitctl enable can get stuck in service activation status report because of missing SERVICEEVENT #363

Closed
@mobin-2008

Description

@mobin-2008

Describe the bug
This is a really weird one. Sometimes the dinitctl enable get stuck after the "enabled" message.

To Reproduce

  1. Have a minimal service set (including boot and boot.d)
  2. Add a fail-fast service (for example a service with non-exist executable path).
  3. Create a loop with disable and enable:
#!/bin/sh

SERVICE="srv"
SOCKET="/tmp/dinitctl"

i=0
while :; do
    i=$(( i + 1 ))
    echo $i
    dinitctl disable "$SERVICE" --socket-path "$SOCKET"
    dinitctl enable "$SERVICE" --socket-path "$SOCKET"
done
  1. It will stuck after a random number of tries.

Expected behavior
It should not stuck.

Additional context
The dinitctl enables a service with this process:

  1. dinitctl loads a service
  2. dinitctl finds a waits-for.d and add the service in that directory
  3. dinitctl starts the service
  4. dinitctl checks the current state of service with SERVICESTATUS command
  5. dinit responds.
  6. if the status of service wasn't something that dinitctl expects, run wait_service_state()
  7. Report the success or failure.

The problem is dinitctl expects a SERVICEEVENT but sometimes it's missing and dinitctl will stuck on read() syscall (int r = rbuffer.fill_to(socknum, 2);).

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions