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

refactored semaphore-related code #53

Merged
merged 1 commit into from
Oct 3, 2019
Merged

refactored semaphore-related code #53

merged 1 commit into from
Oct 3, 2019

Conversation

i-ky
Copy link
Collaborator

@i-ky i-ky commented Sep 24, 2018

Should resolve #47:

  • moved semaphore-related code into separate source file;
  • changed semaphore set creation to use IPC_PRIVATE;
  • improved error messages.

…hore set creation to use IPC_PRIVATE, improved error messages
@i-ky i-ky requested a review from v-zhuravlev September 24, 2018 23:32
@v-zhuravlev
Copy link
Owner

Would that be hard to develop a simple test to check that port locking is happening? This thing is complex (for me at least) and it would be good to keep under control.

@i-ky
Copy link
Collaborator Author

i-ky commented Sep 25, 2018

Do you want a synthetic test or close to real life scenario? If you know which ill effects the absence of locking can have, then we can try to reproduce these effects in tests.

@v-zhuravlev
Copy link
Owner

When locking is in place - another zabbix process must wait for the first process to finish in order to access the port(resource). Not sure how to test at this point. Ill effects are unpredictable - could be CRC errors, spontaneous timeouts...

@i-ky
Copy link
Collaborator Author

i-ky commented Sep 25, 2018

As I understand, the reason of ill effects is that multiple processes can simultaneously write to the same serial port. But it is difficult to guarantee that, because processes belong to Zabbix and actual writing is done by libmodbus. Even without locking the chance of getting any issues is small provided the number of parallel processes is low and port throughput is high. Making a real-life-like test which will 100% fail if there is something wrong with locking mechanism is quite challenging. We will need:

  • lots of Zabbix processes;
  • lots of parallel requests to the same port;
  • simulate a really slow serial port.

Is it possible and is it worth it?

@v-zhuravlev
Copy link
Owner

v-zhuravlev commented Sep 25, 2018

Even without locking the chance of getting any issues is small provided the number of parallel processes is low and port throughput is high
In real life it just doesn't work without locking - you would get errors all the time.

I was thinking about some simple test(maybe unit level not integrational like we did befie) to test that locking is happening.

@i-ky
Copy link
Collaborator Author

i-ky commented Sep 25, 2018

Depends on #54.

@i-ky i-ky mentioned this pull request May 8, 2019
@v-zhuravlev v-zhuravlev merged commit c0df094 into master Oct 3, 2019
@v-zhuravlev v-zhuravlev deleted the ipc-private branch October 3, 2019 07:07
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.

Create a private semaphore set.
2 participants