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

Replace semaphores in scoped services with a shared semaphore in a hosted service #1195

Closed
andchiind opened this issue Nov 17, 2023 · 5 comments
Assignees
Labels
backend Backend related functionality bug Something isn't working

Comments

@andchiind
Copy link
Contributor

Describe the bug
Semaphores are being ignored since they are local to the current scoped service instance. Each time a different dependency injection is done, a new semaphore is created.

To Reproduce
Set the safezone status off and on several times while debugging. Updating the robot state is not truly being protected by a mutex.

Expected behavior
A semaphore should block any thread from accessing the protected code region. This can be done by storing them in hosted services which only have one instance at a time (as long as flotilla only uses one server at a time).

Screenshots

@andchiind andchiind added bug Something isn't working backend Backend related functionality labels Nov 17, 2023
@andchiind
Copy link
Contributor Author

A singleton might also work instead of a hosted service

@andchiind
Copy link
Contributor Author

andchiind commented Jan 3, 2024

The only remaining problematic Semaphore is in RobotService.cs, but this will become redundant once #1279 is merged.

@andchiind
Copy link
Contributor Author

It did not make it redundant, since the new update functionality does not work with currentArea in the Robot table

@oysand
Copy link
Contributor

oysand commented Jan 8, 2024

Consider removing the semaphore

@UsamaEquinorAFK UsamaEquinorAFK self-assigned this Jan 9, 2024
@UsamaEquinorAFK
Copy link
Contributor

UsamaEquinorAFK commented Jan 9, 2024

Removes semaphores - #1323

@aeshub aeshub closed this as completed Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related functionality bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants