-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
dinitctl: dinitctl enable
can get stuck in service activation status report because of missing SERVICEEVENT
#363
Comments
I can't reproduce after over 30000 iterations:
|
The problem is that your
In this case it get stuck for me and it's really random, one time it will get stuck after ~700 tries, next time it will stuck after second try :/ |
Yes, I was able to reproduce with a service that fails to execute. |
I found out why it happens. Let's take a look at the
This system looks good but there is a race condition: If the
|
The quick fix for this is to change this: Lines 1930 to 1934 in 3867cf1
To this: if (enable) {
if (current != service_state_t::STARTED && target != service_state_t::STOPPED) {
wait_service_state(socknum, rbuffer, to_handle, to, false /* start */, verbose);
}
else {
std::cerr << "Service Failed to start." << std::endl; // TODO: Show more info about the failure
return 1;
}
} @davmac314 Is it a good fix? Or we need to re-implement the |
I don't think there is a race in dinit itself, it's just the events can happen in an order that's not what dinitctl is expecting. The fix you proposed might be ok, I need to have a proper look. Maybe it can be refactored a little. |
With this change we can eliminate the "SERVICESTATUS vs SERVICEEVENT" race. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
With this change we can eliminate the "SERVICESTATUS vs SERVICEEVENT" race. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
With this change we can eliminate the "SERVICESTATUS vs SERVICEEVENT" race. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for SERVICEVENT first; If it wasn't the case, It will be processed normally. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for SERVICEVENT first; If it wasn't the case, It will be processed normally. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for SERVICEVENT first; If it wasn't the case, It will be processed normally. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for SERVICEVENT first; If it wasn't the case, It will be processed normally. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Sometimes it's possible to get SERVICEEVENT before the SERVICESTATUS report. This commit fixes it with waiting for whichever one actually comes first. Fixes davmac314#363 Signed-off-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Describe the bug
This is a really weird one. Sometimes the
dinitctl enable
get stuck after the "enabled" message.To Reproduce
boot
andboot.d
)Expected behavior
It should not stuck.
Additional context
The dinitctl enables a service with this process:
waits-for.d
and add the service in that directorySERVICESTATUS
commandwait_service_state()
The problem is dinitctl expects a
SERVICEEVENT
but sometimes it's missing and dinitctl will stuck onread()
syscall (int r = rbuffer.fill_to(socknum, 2);
).The text was updated successfully, but these errors were encountered: