-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Reduce loop length in runtime event test to avoid overflowing ring buffers #12398
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
Conversation
|
If I understand correctly, this test uses the "self monitoring" approach where an OCaml program listens to its own events. It is written as two nested loops that could be described as such: for i = 1 to epochs do
for a = 1 to majors_per_epoch do
<allocate a lot>
Gc.full_major ();
done;
<poll runtime events accumulated so far>;
done;The intent of the test is that the For a user program, my recommendation to avoid event loss would be to poll more often. Accordingly, my proposal for this test would be to reduce the |
|
Yes, but this goes to the design of this particular test. The purpose of this test is not documented, and is unclear from its version history. The test was clearly close to the limit of ring buffer sizes (in PR #12390 I add a small number of additional events which pushes it over the edge), but it was deliberately structured in this way (large loop count inside small loop count). Not knowing the reason for that original design choice, I decided that I shouldn't touch it, but instead make a trivial change to the ring buffer size, while at the same time improving variable names and adding comments so that the structure of the whole test is clearer. |
|
This test now also tests that the ocamltest control comment at the head of the file can be used to correctly change OCAMLRUNPARAM, to grow the ring buffer size. |
I don't understand. If we believe (I am not convinced) that the test is deliberately structured to test an almost-full-event-buffer scenario, then neither your change (making the buffer comfortably larger) nor my proposal (polling comfortably more often) are good ideas. @sadiqj, as the original author of this test, could you maybe comment on what is a desirable way to make the test more robust to addition of new runtime events?
great, thanks! |
… buffers don't overflow.
|
OK, I've halved the number of collections and taken the ocamlrunparam part out. How's that @gasche ? |
gasche
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me!
tests/lib-runtime-events/test_caml.mlis failing on a recent PR (#12390), because that test nearly exceeds the ring buffer size, and new events added in the PR cause them to overflow and events to be lost. This tiny PR grows the ring buffers in that test, and also adds comments and improves some variable names to make the test easier to hack on in future.