-
Notifications
You must be signed in to change notification settings - Fork 23
Move activation of dispatchers into event loop thread #190
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
🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.
97bf55b to
d477e76
Compare
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.
Thanks for the fix Milind and thanks @trevorr for finding it!
I request just a few changes to solve the flakiness in a different way.
.semaphore/semaphore.yml
Outdated
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.
If --forceExit still needed, are there unhandled promises?
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.
No, sorry, left it in by accident.
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.
I think this won't be needed if some offsets are consumed and committed by the consumer. In that case even if there's a coordinator change, the group would be loaded and be EMPTY instead of DEAD.
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.
It's ensured better with:
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.
We can leave only this one to get a single batch
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.
We can verify it with partitionsConsumedConcurrently >= 2
If you set
const messagesConsumed = []; const expectedMaxConcurrentWorkers = Math.min(partitionsConsumedConcurrentlyDiff, partitions); const maxConcurrentWorkersReached = new DeferredPromise();
and then
eachMessage: async event => { inProgress++; messagesConsumed.push(event); inProgressMaxValue = Math.max(inProgress, inProgressMaxValue); if (inProgressMaxValue >= expectedMaxConcurrentWorkers) { maxConcurrentWorkersReached.resolve(); } else if (messagesConsumed.length > 30) { await sleep(1000); } inProgress--; },
and finally
await maxConcurrentWorkersReached; expect(inProgressMaxValue).toBe(expectedMaxConcurrentWorkers);
the sleep inside the invocation makes sure that worker invocations can overlap and reach that value. First messages are skipped as there's the exponential cache growth.
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.
I got good results on making this change but I changed messagesConsumed.length > 30 to messagesConsumed.length > 2048. As it will make sure we've completely maxed out the cache capacity by this time.
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.
DeferredPromise can be imported and exported from here for usage from rest of the tests.
test/promisified/testhelpers.js
Outdated
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.
Let's keep the logs with level <= 5 (NOTICE) . Otherwise we could not see some error or warning. If there are expected errors in the tests a custom logger could be added later to assert their message and avoid logging it.
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.
In case it works, this change could be reverted
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.
LGTM!
Uh oh!
There was an error while loading. Please reload this page.