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

Throw exception 'Capacity must be a power of two' #282

Closed
oPiZiL opened this issue Apr 17, 2023 · 8 comments · Fixed by #283
Closed

Throw exception 'Capacity must be a power of two' #282

oPiZiL opened this issue Apr 17, 2023 · 8 comments · Fixed by #283
Labels
bug Something isn't working

Comments

@oPiZiL
Copy link

oPiZiL commented Apr 17, 2023

Apr 14 16:57:55 user-174316638 bash[13005]: terminate called after throwing an instance of 'std::runtime_error'
Apr 14 16:57:55 user-174316638 bash[13005]:   what():  Capacity must be a power of two
Apr 14 16:57:55 user-174316638 bash[13005]: Stack trace (most recent call last):
Apr 14 16:57:55 user-174316638 bash[13005]: #29   Object "", at 0xffffffffffffffff, in
Apr 14 16:57:55 user-174316638 bash[13005]: #28   Object "/run/bin/app", at 0x4e9248, in _start
Apr 14 16:57:55 user-174316638 bash[13005]: #27   Source "/build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c", line 291, in __libc_start_main [0x7fba3835c82f]
Apr 14 16:57:55 user-174316638 bash[13005]: #26   Source "/builds/app/code/app/src/main.cpp", line 188, in main [0x4e6812]
Apr 14 16:57:55 user-174316638 bash[13005]: #25   Object "/run/bin/../lib/libQt5Core.so.5", at 0x7fba3b33665f, in QCoreApplication::exec()
Apr 14 16:57:55 user-174316638 bash[13005]: #24   Object "/run/bin/../lib/libQt5Core.so.5", at 0x7fba3b32dc19, in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
Apr 14 16:57:55 user-174316638 bash[13005]: #23   Object "/run/bin/../lib/libQt5Core.so.5", at 0x7fba3b38676e, in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
Apr 14 16:57:55 user-174316638 bash[13005]: #22   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fba3496949b, in g_main_context_iteration
Apr 14 16:57:55 user-174316638 bash[13005]: #21   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fba349693ef, in g_main_context_dispatch
Apr 14 16:57:55 user-174316638 bash[13005]: #20   Object "/lib/x86_64-linux-gnu/libglib-2.0.so.0", at 0x7fba34969196, in g_main_context_dispatch
Apr 14 16:57:55 user-174316638 bash[13005]: #19   Object "/run/plugins/platforms/../../lib/libQt5XcbQpa.so.5", at 0x7fba2fcd4f32, in xcbSourceDispatch(_GSource*, int (*)(void*), void*)
Apr 14 16:57:55 user-174316638 bash[13005]: #18   Object "/run/plugins/platforms/../../lib/libQt5XcbQpa.so.5", at 0x7fba2fcad801, in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>)
Apr 14 16:57:55 user-174316638 bash[13005]: #17   Source "/build/glibc-bfm8X4/glibc-2.23/stdlib/exit.c", line 104, in __GI_exit [0x7fba38376044]
Apr 14 16:57:55 user-174316638 bash[13005]: #16   Source "/build/glibc-bfm8X4/glibc-2.23/stdlib/exit.c", line 82, in __run_exit_handlers [0x7fba38375ff7]
Apr 14 16:57:56 user-174316638 bash[13005]: #15   Source "/home/user/.cache/CPM/freeglut/8da0e380b43fc44557c6dbe1689440517b082cff/src/fg_init.c", line 321, in fgDeinitialize [0x7fba3d5bca66]
Apr 14 16:57:56 user-174316638 bash[13005]: #14   Object "/usr/lib/x86_64-linux-gnu/libX11.so.6", at 0x7fba37b5361d, in XCloseDisplay
Apr 14 16:57:56 user-174316638 bash[13005]: #13   Object "/usr/lib/x86_64-linux-gnu/libX11.so.6", at 0x7fba37b7248c, in XSync
Apr 14 16:57:56 user-174316638 bash[13005]: #12   Object "/usr/lib/x86_64-linux-gnu/libX11.so.6", at 0x7fba37b76d49, in _XReply
Apr 14 16:57:56 user-174316638 bash[13005]: #11   Object "/usr/lib/x86_64-linux-gnu/libX11.so.6", at 0x7fba37b78ced, in _XIOError
Apr 14 16:57:56 user-174316638 bash[13005]: #10   Object "/run/plugins/platforms/../../lib/libQt5XcbQpa.so.5", at 0x7fba2fcd54e1, in ioErrorHandler(_XDisplay*)
Apr 14 16:57:56 user-174316638 bash[13005]: #9    Object "/run/bin/../lib/libQt5Core.so.5", at 0x7fba3b13f95f, in QMessageLogger::warning(char const*, ...) const
Apr 14 16:57:56 user-174316638 bash[13005]: #8    Object "/run/bin/../lib/libQt5Core.so.5", at 0x7fba3b1565ff, in qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*)
Apr 14 16:57:56 user-174316638 bash[13005]: #7  | Source "/builds/app/code/util/src/logger.cpp", line 175, in Logger::customMessageOutput(QtMsgType, QMessageLogContext const&, QString const&)
Apr 14 16:57:56 user-174316638 bash[13005]:     | Source "/quill/include/quill/Logger.h", line 150, in log<Logger::customMessageOutput(QtMsgType, const QMessageLogContext&, const QString&)::<unnamed struct>, Logger::customMessageOutput(QtMsgType, const QMessageLogContext&, const QString&)::<lambda()>::FMT_COMPILE_STRING, char const*, int const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >
Apr 14 16:57:56 user-174316638 bash[13005]:       Source "/quill/include/quill/detail/spsc_queue/UnboundedQueue.h", line 107, in quill::detail::UnboundedQueue::prepare_write(unsigned int) [0x7fba3d615311]
Apr 14 16:57:56 user-174316638 bash[13005]: #6  | Source "/quill/include/quill/detail/spsc_queue/UnboundedQueue.h", line 42, in quill::detail::UnboundedQueue::Node::Node(unsigned int)
Apr 14 16:57:56 user-174316638 bash[13005]:       Source "/quill/include/quill/detail/spsc_queue/BoundedQueue.h", line 37, in quill::detail::BoundedQueue::BoundedQueue(unsigned int) [0x7fba3d6161ab]
Apr 14 16:57:56 user-174316638 bash[13005]: #5    Object "/run/bin/../lib/libstdc++.so.6", at 0x7fba38ccaa64, in __cxa_throw
Apr 14 16:57:56 user-174316638 bash[13005]: #4    Object "/run/bin/../lib/libstdc++.so.6", at 0x7fba38cca810, in std::terminate()
Apr 14 16:57:56 user-174316638 bash[13005]: #3    Object "/run/bin/../lib/libstdc++.so.6", at 0x7fba38cca7a5, in std::rethrow_exception(std::__exception_ptr::exception_ptr)
Apr 14 16:57:56 user-174316638 bash[13005]: #2    Object "/run/bin/../lib/libstdc++.so.6", at 0x7fba38cbeddd, in __cxa_throw_bad_array_new_length
Apr 14 16:57:56 user-174316638 bash[13005]: #1    Source "/build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c", line 89, in __GI_abort [0x7fba38373029]
Apr 14 16:57:56 user-174316638 bash[13005]: #0    Source "/build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c", line 54, in __GI_raise [0x7fba38371428]
Apr 14 16:57:56 user-174316638 bash[13005]: Aborted (Signal sent by tkill() 13005 0)
@oPiZiL
Copy link
Author

oPiZiL commented Apr 17, 2023

version: 0327e3f

@odygrd
Copy link
Owner

odygrd commented Apr 17, 2023

Hey, can you provide more details please.
Are you trying to change the default queue capacity in the config?

@odygrd
Copy link
Owner

odygrd commented Apr 17, 2023

I think you are explicitly changing the queue size to a non power of 2 in order to get this error, i do not see any other way of getting it. I made a PR that will automatically round it up to the next power of 2

@odygrd odygrd linked a pull request Apr 17, 2023 that will close this issue
@oPiZiL
Copy link
Author

oPiZiL commented Apr 17, 2023

I didn't explicitly changing the queue size. That happened occasionally.

@odygrd
Copy link
Owner

odygrd commented Apr 17, 2023

Thanks for reporting. It is difficult to figure out why it happened. I have improved the exception message and also now always rounding up to the nearest power of 2. It shouldn't happen again after this commit, but if it does please let me know

@odygrd
Copy link
Owner

odygrd commented Apr 17, 2023

Please use 57f8104

It seems that the queue grew above 2.1 gb in your case

@odygrd odygrd added the bug Something isn't working label Apr 17, 2023
@oPiZiL
Copy link
Author

oPiZiL commented Apr 18, 2023

Please use 57f8104

It seems that the queue grew above 2.1 gb in your case

How did it happen?

@odygrd
Copy link
Owner

odygrd commented Apr 18, 2023

In the version you are using capacity can overflow

It needs to be capped to the max power of 2 we can represent with a uint32_t that is 2^31
0e6285c

later comits were caping it to uint32_t::max() which was also wrong and not a power of 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants