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

PHP is crashing hard on large Type structures #43

Closed
mabar opened this issue Dec 4, 2022 · 2 comments · Fixed by #46
Closed

PHP is crashing hard on large Type structures #43

mabar opened this issue Dec 4, 2022 · 2 comments · Fixed by #46

Comments

@mabar
Copy link
Member

mabar commented Dec 4, 2022

orisai/openapi currently fails on creation of whole Type structure of the OpenAPI class if all nodes are allowed, because it creates more than ~10k objects and PHP fails with Exit Code: 139(Segmentation violation)

While it could be fixed by PHP, this whole structure is unreasonable. Instead, we could do this:

  • MappedObjectType should be replaced with a lazy implementation - only when MappedObjectType is used, its inner objects are created. This would keep inicialized structure only in two levels of mapped objects at a time.
  • When processing Type structure (mostly in Printer), types must be dereferenced as soon as we obtain all their inner types, so PHP could destroy them
  • In Printer, write only first level of MappedObjectType on error, so we don't have to print stupidly large structures
@mabar
Copy link
Member Author

mabar commented Dec 5, 2022

Types themselves will have to store information if they are the first in hierarchy - simple circural references check as currently implemented by MappedObjectRule will be no longer possible, because structure will be created JIT, instead of immediately.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant