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

Trying to reserve more bytes than the bounded queue capacity #215

Closed
jkawnkwh85 opened this issue Jan 5, 2023 · 3 comments
Closed

Trying to reserve more bytes than the bounded queue capacity #215

jkawnkwh85 opened this issue Jan 5, 2023 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@jkawnkwh85
Copy link

jkawnkwh85 commented Jan 5, 2023

I got the above error message. Does that mean my log message is too long so that the ring buffer can not hold the message?

@odygrd
Copy link
Owner

odygrd commented Jan 5, 2023

yes, the way it works is that there is a bounded queue (ring buffer) with the capacity as template parameter.

When the existing ring buffer is full another new empty ring buffer gets allocated to emplace there the message. However, the capacity of the queue (ring buffer) is always the same as the one specified during compilation and the log message cannot exceed the capacity of the bounded buffer.

When you get that assertion https://github.com/odygrd/quill/blob/master/quill/include/quill/detail/spsc_queue/UnboundedQueue.h#L118 it means that a new empty ring buffer was allocated but the log message or the size of the object still didn't fit in the empty buffer.

The default capacity of the buffer is 131'072 bytes

You can change the capacity here and it requires to recompile the logger (https://github.com/odygrd/quill/blob/master/quill/include/quill/TweakMe.h#L141)

@odygrd odygrd added the question Further information is requested label Jan 5, 2023
@odygrd
Copy link
Owner

odygrd commented Jan 6, 2023

This seemed like a limitation to me so there is a fix for it in master and also v2.6.0.
The unbounded queue will now resize to a capacity that is at least the size of the message.

The initial size of the unbounded queue is also configurable in runtime now and no longer needed to recompile.

  quill::Config cfg;
  cfg.default_queue_capacity = 65'536
  quill::configure(cfg);
  quill::start();

@odygrd odygrd closed this as completed Jan 6, 2023
@odygrd odygrd added the enhancement New feature or request label Jan 6, 2023
@jkawnkwh85
Copy link
Author

Cool! thanks for the detailed explanation and the improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants