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

xmerl_sax_parser:stream/2 stack keeps growing until the VM is OOM #9190

Open
leoliu opened this issue Dec 14, 2024 · 1 comment
Open

xmerl_sax_parser:stream/2 stack keeps growing until the VM is OOM #9190

leoliu opened this issue Dec 14, 2024 · 1 comment
Assignees
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS

Comments

@leoliu
Copy link
Contributor

leoliu commented Dec 14, 2024

Describe the bug
The stack_size of the process running xmerl_sax_parser:stream/2 keeps growing.

To Reproduce
Use xmerl_sax_parser:stream/2 on a large file and observe the stack growing by checking process_info(Pid, stack_size).

Expected behavior
I expect the stream parser to handle infinite stream without blowing up the stack.

Affected versions
Tested on 27.2 but seems all versions are affected.

Additional context
I used xmerl_sax_parser:stream/2 to parse the XML stream from an ejabberd server and noticed after a while the VM is killed by the OOM killer. After some inspection the process has a huge stack_size that keeps growing.

I also verified that removing the error handling in the first two clauses of xmerl_sax_parser_utf8:parse_content/4 and keeping just the cf/5 calls i.e. making it tail-recursive, the stack size is constant.

@leoliu leoliu added the bug Issue is reported as a bug label Dec 14, 2024
@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Dec 16, 2024
@lthor
Copy link
Contributor

lthor commented Dec 20, 2024

This is planned to fix in the next sprint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

3 participants