Skip to content

Raise DEFAULT_RECURSE_LIMIT from 511 to 1024#676

Merged
methane merged 3 commits into
mainfrom
copilot/fix-fallback-recursion-limit
May 22, 2026
Merged

Raise DEFAULT_RECURSE_LIMIT from 511 to 1024#676
methane merged 3 commits into
mainfrom
copilot/fix-fallback-recursion-limit

Conversation

Copilot AI commented May 20, 2026

Copy link
Copy Markdown
Contributor
  • Change DEFAULT_RECURSE_LIMIT from 511 to 1024 in msgpack/fallback.py
  • Change DEFAULT_RECURSE_LIMIT from 511 to 1024 in msgpack/_packer.pyx
  • Add test for packing/unpacking an object with nest level 1024 (iterative comparison to avoid C-level recursion limit in ==)

Copilot AI changed the title [WIP] Fix msgpack.fallback DEFAULT_RECURSE_LIMIT to match Python 3.10 Raise DEFAULT_RECURSE_LIMIT from 511 to 1024 May 20, 2026
Copilot AI requested a review from methane May 20, 2026 08:42
@methane methane marked this pull request as ready for review May 20, 2026 11:52
Comment thread test/test_limits.py Outdated
sys.setrecursionlimit(max(old_limit, 10000))
try:
packed = packb(d)
assert unpackb(packed) == d

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot この == が インタプリタ内部の recursion limit に当たってRuntimeErrorになるんだ。これはCレベルの制限だから sys.setrecursionlimit() では対策できない。

json.dumps(packed) == json.dumps(d) にしてくれる?もしくは他にいいやり方があったら提案お願い。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 30e46c8. Instead of using == (which recurses through the 1024-level structure at C level), the test now iteratively unwraps the result one level at a time and asserts structure/type at each step, avoiding any deep recursion in the comparison.

Copilot AI requested a review from methane May 20, 2026 14:32
@methane methane merged commit 4b2749c into main May 22, 2026
28 checks passed
@methane methane deleted the copilot/fix-fallback-recursion-limit branch May 22, 2026 07:08
phoebusm added a commit to man-group/ArcticDB that referenced this pull request Jun 12, 2026
#### Reference Issues/PRs
<!--Example: Fixes #1234. See also #3456.-->
Fix `test_deep_nesting_metastruct_size_over_limit` and
`test_deep_nesting_metastruct_size_under_limit`
Culprit: `msgpack 1.2.0` has just released. It includes [Raise
DEFAULT_RECURSE_LIMIT from 511 to 1024 by Copilot · Pull Request #676 ·
msgpack/msgpack-python](msgpack/msgpack-python#676)
which changes `DEFAULT_RECURSE_LIMIT` from 511 to 1024
`python 3.9` is unaffected as the new msgpack version has dropped the
support

#### What does this implement or fix?
Hard-pin the arcticdb limit to `511` as msgpack <1.2.0
#### Any other comments?
msgpack <1.2.0 has the recurse limit set at 511. arcticdb imports the
limit from msgpack to calculate the metastruct layer limit
msgpack 1.2.0 has raised limit from 511 to 1024. Since reconstructing
the metastruct from is done by recursion, increasing the no. of layers
in the metastruct will make arcticdb hit the python recursion limit.
#### Checklist

<details>
  <summary>
   Checklist for code changes...
  </summary>
 
- [ ] Have you updated the relevant docstrings, documentation and
copyright notice?
- [ ] Is this contribution tested against [all ArcticDB's
features](../docs/mkdocs/docs/technical/contributing.md)?
- [ ] Do all exceptions introduced raise appropriate [error
messages](https://docs.arcticdb.io/error_messages/)?
 - [ ] Are API changes highlighted in the PR description?
- [ ] Is the PR labelled as enhancement or bug so it appears in
autogenerated release notes?
</details>

<!--
Thanks for contributing a Pull Request to ArcticDB! Please ensure you
have taken a look at:
- ArcticDB's Code of Conduct:
https://github.com/man-group/ArcticDB/blob/master/CODE_OF_CONDUCT.md
- ArcticDB's Contribution Licensing:
https://github.com/man-group/ArcticDB/blob/master/docs/mkdocs/docs/technical/contributing.md#contribution-licensing
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

msgpack.fallback DEFAULT_RECURSE_LIMIT smaller than python 3.10 default

2 participants