-
Notifications
You must be signed in to change notification settings - Fork 88
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
Stack overflow in debug build when translating policy cedar->json #1353
Comments
The overflow is during CST->EST translation, specifically |
Some possible refactors to reduce stack usage would rely on the optimizer; for instance, trying to create opportunities for tail-call optimization. But the optimizer only really runs on release builds. I'm now questioning whether it's worth trying to avoid stack overflows on policies like this in debug builds. Perhaps it only makes sense to worry about release builds. |
I there a reason why this overflows for CST->EST but not CST->AST? It feels like these should have the same structure |
Maybe it does overflow for CST->AST as well, but this particular operation doesn't construct an AST, or tries to construct an EST first? |
|
backtrace from
....
|
Doh, I made a stupid mistake in my own analysis. Upon further investigation I agree that's the cause haha |
Does that mean this issue is out of scope then? Is the problem with |
Probably out of scope in this case. I'm not sure what we could do other than making the EST shallower, which we wouldn't want to do. Does our nightly testing run the debug build? I would think it using a release build and this stack overflow was found by it, so we can't entirely write this off just because it's hard to reproduce in the release build. |
I found that To me this suggests two things:
|
Before opening, please confirm:
Bug Category
Other
Describe the bug
There is a stack overflow in the debug build when translating a large enough policy from Cedar format to JSON format. The size of policy needed to trigger this is large but not obscenely large, enough that this is probably worth fixing. The stack overflow doesn't happen in the release build though, so this is a low priority.
Expected behavior
No stack overflow. Either an error or, ideally, a correct JSON result.
Reproduction steps
cedar
commit dd6b9f0 (latestmain
as of this writing)cd cedar-policy-cli
problem.cedar
:Note that the problem doesn't reproduce if you add
--release
to thecargo run
command, which is why this is low priorityCode Snippet
No response
Log output
No response
Additional configuration
No response
Operating System
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: