Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adjust stack size for releasing with clang-13 #791

Closed
sanikolaev opened this issue May 30, 2022 · 1 comment
Closed

Adjust stack size for releasing with clang-13 #791

sanikolaev opened this issue May 30, 2022 · 1 comment

Comments

@sanikolaev
Copy link
Collaborator

Tests 144, 411 permanently fails with crash, when run 'release test' on binaries made with clang-13.

That is quite serious, as our tests run being built with 'traditional' gcc, but our releases are now made with clang.
That means, that all of them are vulneable (i.e. will crash) on deep queries.

Experimenting reveals correct size of the frame SPH_EXTNODE_STACK_SIZE as 0x120 (=288 both, for debug and release)
Current value is 160 for release and 0x120 for debug.


A bit of details 'how to know'.

  1. Run deep query under gdb
  2. When it stop, ensure, stack is full of similar calculation frames, as
...
#1750 0x0000000000b11ccd in ExtOr_c::CollectHits (this=0x7f38bc794bb0, pDocs=0x7f38bc26b180) at /builds/manticoresearch/dev/src/searchnode.cpp:3628
#1751 0x0000000000b08b15 in ExtNode_c::GetHits (this=0x7f38bc794bb0, pDocs=0x7f38bc26b180) at /builds/manticoresearch/dev/src/searchnode.cpp:1319
#1752 0x0000000000b11ccd in ExtOr_c::CollectHits (this=0x7f38bc795a90, pDocs=0x7f38bc26b180) at /builds/manticoresearch/dev/src/searchnode.cpp:3628
#1753 0x0000000000b08b15 in ExtNode_c::GetHits (this=0x7f38bc795a90, pDocs=0x7f38bc26b180) at /builds/manticoresearch/dev/src/searchnode.cpp:1319
...
  1. In gdb, info registers, then up, up, then info registers again (as we see, frames pattern includes 2 calls interleaved, so we see 1-nd and 3-rd to know stack delta between same calls). Notice the value of rsp. That is:
rsp            0x7f38d6dd1090      0x7f38d6dd1090
...
rsp            0x7f38d6dd11b0      0x7f38d6dd11b0

Here we see final delta as 0x1b0-0x090, that is 0x120.

@sanikolaev
Copy link
Collaborator Author

Fixed in f679ab9

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant