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

stackoverflow while formatting JSON #5548

Open
kim-em opened this issue Oct 1, 2024 · 2 comments
Open

stackoverflow while formatting JSON #5548

kim-em opened this issue Oct 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@kim-em
Copy link
Collaborator

kim-em commented Oct 1, 2024

Description

#eval (toString (toJson (Array.mkArray 70000 "string1"))).length

results in a stackoverflow. It is either in Std.Format.be, or some function that it is calling.

I'm uncertain if this is intrinsic to the design of be, or that some function has mistakenly become non-TR.

Context

This was reduced from the equational-theories project.

I did attempt to run lldb on this, but couldn't get a useful stacktrace out.

Versions

nightly-2024-09-30

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@kim-em kim-em added the bug Something isn't working label Oct 1, 2024
@kim-em
Copy link
Collaborator Author

kim-em commented Oct 1, 2024

On the other hand

#eval (toJson (Array.mkArray 70000 "string1")).compress.length

is fine.

@digama0
Copy link
Collaborator

digama0 commented Oct 1, 2024

It is intrinsic to the formatter. The issue is that it is properly recursive, it has to deal with deep Format objects which are both left leaning and right leaning. The formatter could be modified to use an explicit stack, and I think it should; the non-tail-recursiveness of the formatter has caused many bug reports over the years.

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

No branches or pull requests

2 participants