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

Ref counting MFiles #887

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Ref counting MFiles #887

wants to merge 9 commits into from

Conversation

carlhoerberg
Copy link
Member

WHAT is this pull request doing?

Keep track of usage of MFiles, and only mmap when needed

HOW can this pull request be tested?

Specs

probably wont do much against race conditions, but at least in theory it
could be better
Can cause seg faults if a follower is still trying
to replicate it.
So that the errors can be caught in specs.
In lavinmq.cr is the exit done
Add a random delay to the stream queue GC loops,
so that not all loops are executing at the same time.
So that the files are closed after each spec
@carlhoerberg carlhoerberg requested a review from a team as a code owner December 17, 2024 00:53
@carlhoerberg carlhoerberg marked this pull request as draft December 17, 2024 00:54
@carlhoerberg carlhoerberg changed the title Ref counting mfiles Ref counting MFiles Dec 17, 2024
Copy link
Member

@spuun spuun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it crashed:

mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
unmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
unmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
2024-12-17T07:52:37.467231Z INFO lmq.message_store[queue: "perf-test", vhost: "/"] Loaded 1 segments, 0 messages
mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/acks.0000000001
mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000002
unmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/acks.0000000001
mmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/acks.0000000002
unmap /tmp/lavinmq-cluster/42099b4af021e53fd8fd4e056c2568d7c2e3ffa8/96e488d035f3c5aec50b494f6a7973ff287b6bdd/msgs.0000000001
[1] 70930 segmentation fault ./bin/lavinmq-ref-counting-mfiles -c clustering.ini

Thoughts:

  • May there be a case when a MFile has been closed and borrow is called?
  • Shouldn't ByteMessage borrow? Or, what about we pass a "lease" with Envelope?

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