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

Problem: Crash (abort/sigsegv) when dealing with single participant in elections #738

Merged
merged 3 commits into from
Oct 2, 2023

Conversation

Mathsoum
Copy link
Contributor

@Mathsoum Mathsoum commented Sep 27, 2023

Previous PR about single participant in elections did not clean the group structure properly.
This was causing crashes in specific situations when there have been an election, then one peer was left alone in this election. The structure was not clean and thus when some other peer left, when read garbage memory.

Solution: Clean leader/election attributes of zyre_group when dealing with single participant in elections.

NOTE:
5d15a8b First commit cleans up the attributes.
908553a Second commit change some ifs to avoid checking the same condition multiple times.
1f163ef Bump the patch version to track bugfix

@bluca
Copy link
Member

bluca commented Sep 29, 2023

Why is this changing the version? Please remove that

@Mathsoum
Copy link
Contributor Author

I thought PATCH version numbers were used to notify a bugfix.
Why wouldn't we increase the version in this case ?

@bluca
Copy link
Member

bluca commented Sep 30, 2023

breaks windows build:

C:\projects\zyre\src\zyre_node.c(947,54): error C2664: 'void zyre_group_set_leader(zyre_group_t *,zyre_peer_t *)': cannot convert argument 2 from 'zyre_node_t *' to 'zyre_peer_t *' [C:\projects\zyre\build\zyre.vcxproj]
C:\projects\zyre\src\zyre_node.c(947,50): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast [C:\projects\zyre\build\zyre.vcxproj]
C:\projects\zyre\src\zyre_group.h(73,5): message : see declaration of 'zyre_group_set_leader' [C:\projects\zyre\build\zyre.vcxproj]
C:\projects\zyre\src\zyre_node.c(1239,58): error C2664: 'void zyre_group_set_leader(zyre_group_t *,zyre_peer_t *)': cannot convert argument 2 from 'zyre_node_t *' to 'zyre_peer_t *' [C:\projects\zyre\build\zyre.vcxproj]
C:\projects\zyre\src\zyre_node.c([1239](https://ci.appveyor.com/project/zeromq/zyre/builds/48163333/job/wa49rytidt6epykv#L1239),54): message : Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast [C:\projects\zyre\build\zyre.vcxproj]
C:\projects\zyre\src\zyre_group.h(73,5): message : see declaration of 'zyre_group_set_leader'

@Mathsoum
Copy link
Contributor Author

Mathsoum commented Oct 2, 2023

My mistake.
I though I could set the current peer as the leader of an election where it's the only one present but actually, with a single peer there are no election and therefore no leader.
It is now set to NULL in that case and will be changed during the next election.

@bluca bluca merged commit 2f25b4b into zeromq:master Oct 2, 2023
7 checks passed
Mathsoum pushed a commit to zeromq/ingescape that referenced this pull request Oct 2, 2023
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