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

Assertion `poolIndex < count_' failed #2092

Closed
folkertvanheusden opened this issue May 14, 2024 · 1 comment
Closed

Assertion `poolIndex < count_' failed #2092

folkertvanheusden opened this issue May 14, 2024 · 1 comment
Labels
question v7 ArduinoJson 7

Comments

@folkertvanheusden
Copy link

folkertvanheusden commented May 14, 2024

Describe the bug
During serialization things crash.

Troubleshooter report
The troubleshooter generator says "talk to a human".

Environment

  • Microcontroller: Linux
  • Core/runtime: Posix
  • IDE: not applicable

Reproduction

That's a bit complicated. I've tried to shrink it but failed sofar. But if I need to try anything; let me know!

Program output

==466873== Memcheck, a memory error detector
==466873== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==466873== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==466873== Command: ./build/kek -r work/werkend-mu/unix_v7m_rl0.dsk -r work/werkend-mu/unix_v7m_rl1.dsk -b -L error,info -l /home/folkert/temp/ramdisk/test2.log -d -S 256 -P
==466873==
kek: /home/folkert/Projects/PDP-11/arduinojson/src/ArduinoJson/Memory/VariantPoolList.hpp:98: ArduinoJson::V704HB42::detail::VariantSlot* ArduinoJson::V704HB42::detail::VariantPoolList::getSlot(ArduinoJson::V704HB42::detail::SlotId) const: Assertion `poolIndex < count_' failed.
==466873==
==466873== Process terminating with default action of signal 6 (SIGABRT)
==466873==    at 0x4C1CA1B: __pthread_kill_implementation (pthread_kill.c:44)
==466873==    by 0x4C1CA1B: __pthread_kill_internal (pthread_kill.c:78)
==466873==    by 0x4C1CA1B: pthread_kill@@GLIBC_2.34 (pthread_kill.c:89)
==466873==    by 0x4BC58E5: raise (raise.c:26)
==466873==    by 0x4BA98B6: abort (abort.c:79)
==466873==    by 0x4BA97DA: __assert_fail_base.cold (assert.c:92)
==466873==    by 0x4BBC205: __assert_fail (assert.c:101)
==466873==    by 0x11EA8D: ArduinoJson::V704HB42::detail::VariantPoolList::getSlot(unsigned int) const (VariantPoolList.hpp:98)
==466873==    by 0x11F01B: ArduinoJson::V704HB42::detail::ResourceManager::getSlot(unsigned int) const (ResourceManager.hpp:64)
==466873==    by 0x15929C: ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> >::visit(ArduinoJson::V704HB42::detail::ObjectData const&) (JsonSerializer.hpp:48)
==466873==    by 0x158A76: ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> >::result_type ArduinoJson::V704HB42::detail::VariantData::accept<ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> > >(ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> >&) const (VariantData.hpp:37)
==466873==    by 0x158687: ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> >::result_type ArduinoJson::V704HB42::detail::VariantData::accept<ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> > >(ArduinoJson::V704HB42::detail::VariantData const*, ArduinoJson::V704HB42::detail::JsonSerializer<ArduinoJson::V704HB42::detail::Writer<state_writer, void> >&) (VariantData.hpp:69)
==466873==    by 0x157F13: unsigned long ArduinoJson::V704HB42::detail::doSerialize<ArduinoJson::V704HB42::detail::JsonSerializer, ArduinoJson::V704HB42::detail::Writer<state_writer, void> >(ArduinoJson::V704HB42::JsonVariantConst, ArduinoJson::V704HB42::detail::Writer<state_writer, void>) (serialize.hpp:15)
==466873==    by 0x1572F2: unsigned long ArduinoJson::V704HB42::detail::serialize<ArduinoJson::V704HB42::detail::JsonSerializer, state_writer>(ArduinoJson::V704HB42::JsonVariantConst, state_writer&) (serialize.hpp:22)
==466873==    by 0x156642: unsigned long ArduinoJson::V704HB42::serializeJson<state_writer>(ArduinoJson::V704HB42::JsonVariantConst, state_writer&) (JsonSerializer.hpp:133)
==466873==    by 0x150AD8: serialize_state(console*, bus const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (debugger.cpp:558)
==466873==    by 0x1538DA: debugger(console*, bus*, std::atomic<unsigned int>*) (debugger.cpp:932)
==466873==    by 0x167A41: main (main.cpp:666)
==466873==
==466873== HEAP SUMMARY:
==466873==     in use at exit: 2,256,343 bytes in 64 blocks
==466873==   total heap usage: 135 allocs, 71 frees, 2,267,521 bytes allocated
==466873==
==466873== LEAK SUMMARY:
==466873==    definitely lost: 0 bytes in 0 blocks
==466873==    indirectly lost: 0 bytes in 0 blocks
==466873==      possibly lost: 1,216 bytes in 4 blocks
==466873==    still reachable: 2,255,127 bytes in 60 blocks
==466873==         suppressed: 0 bytes in 0 blocks
==466873== Rerun with --leak-check=full to see details of leaked memory
==466873==
==466873== For lists of detected and suppressed errors, rerun with: -s
==466873== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
@bblanchon
Copy link
Owner

Hi @folkertvanheusden,

ArduinoJson is already very well tested, so the bug is likely to be in your code.
I cannot help you without the reproduction code.

Best regards,
Benoit

@bblanchon bblanchon added question v7 ArduinoJson 7 and removed bug labels May 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question v7 ArduinoJson 7
Projects
None yet
Development

No branches or pull requests

2 participants