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

OOM trying to generate go from AsyncAPI schema #41

Closed
DerekStrickland opened this issue Aug 31, 2021 · 5 comments
Closed

OOM trying to generate go from AsyncAPI schema #41

DerekStrickland opened this issue Aug 31, 2021 · 5 comments

Comments

@DerekStrickland
Copy link

DerekStrickland commented Aug 31, 2021

I ran into this error using json-cli - but the error points me to this repository.

To reproduce, run the following

json-cli gen-go https://raw.githubusercontent.com/asyncapi/bindings/master/http/json_schemas/operation.json

And you should see

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 266240 bytes) in phar:///usr/local/go/bin/json-cli/vendor/swaggest/go-code-builder/src/GoCodeBuilder.php on line 61

I'm trying to generate an HTTP binding that I can contribute to your go-asyncapi project. I've tried upping the memory limit all the way to 2GB and it still fails. I'm trying to find a fix myself, but I have never even set up a PHP development environment, so if you have any advice or fixes they would be welcome.

For what it's worth, this fails in that repo as well running make gen-2.0.0 after adding the file referenced above as http-operation-binding-object-0.1.0.json and then referencing it in asyncapi-2.0.0.json.

Changes can be seen here

@vearutop
Copy link
Member

This issue was fixed in https://github.com/swaggest/go-code-builder/releases/tag/v0.4.47, I'll update json-cli with latest version.

There is another issue discovered during AsyncAPI v2.1.0 generation that needs to be fixed: #42. Will have a fix some time soon.

@DerekStrickland
Copy link
Author

Thanks @vearutop!

@DerekStrickland
Copy link
Author

Fixed with latest json-cli update. Thanks again!

@vearutop
Copy link
Member

vearutop commented Sep 1, 2021

Yes, but I think it won't work properly still, because of incorrect handling of logical schemas (as in failing test here https://github.com/swaggest/go-asyncapi/pull/10/checks?check_run_id=3456189267). I think I'll have it fixed tomorrow and will upgrade go-asyncapi with latest code generation. Then it should be easier to add new bindings (http) on top.

@vearutop
Copy link
Member

vearutop commented Sep 4, 2021

The go-asyncapi repo should now be ready (updated with latest json-cli and new spec version) for new binding classes.

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

No branches or pull requests

2 participants