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

JavaScript heap out of memory error when using --legacy #4885

Closed
PerryCodes opened this issue Jun 28, 2024 · 6 comments
Closed

JavaScript heap out of memory error when using --legacy #4885

PerryCodes opened this issue Jun 28, 2024 · 6 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that v2 Version 2 of AutoRest C# generator.

Comments

@PerryCodes
Copy link

PerryCodes commented Jun 28, 2024

I'm trying to use the --legacy option and it generates the following error:

AutoRest code generation utility [cli version: 3.7.1; node: v12.19.1]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    | AutoRest core version selected from configuration: ~2.0.4413.
   Loading AutoRest core      'C:\Users\jperr\.autorest\@[email protected]\nodemodules\@microsoft.azure\autorest-core\dist' (2.0.4429)
   Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.102)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)

<--- Last few GCs --->
3)[42072:000001E712DE7150]   379828 ms: Mark-sweep 2040.9 (2063.6) -> 2039.2 (2065.4) MB, 1301.0 / 0.0 ms  (+ 320.0 ms in 70 steps since start of marking, biggest step 11.5 ms, walltime since start of marking 1638 ms) (average mu = 0.118, current mu = 0.010[42072:000001E712DE7150]   381525 ms: Mark-sweep 2042.6 (2065.4) -> 2041.4 (2066.9) MB, 1447.3 / 0.0 ms  (+ 237.5 ms in 55 steps since start of marking, biggest step 7.0 ms, walltime since start of marking 1697 ms) (average mu = 0.063, current mu = 0.007)

<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00007FF68A7F994D]
Security context: 0x035ec77408d1 <JSObject>
    1: ParseNodeInternal(aka ParseNodeInternal) [00000077DB880801] [C:\Users\jperr\.autorest\@[email protected]\node_modules\@microsoft.azure\autorest-core\dist\lib\ref\yaml.js:~87] [pc=000002DB0E4A4DF9](this=0x0142f73404b1 <undefined>,0x027f2cb3e871 <Object map = 000001F57D71FC49>,0x03d30a1f3431 <Object map = 000002EDC19FE1E9>,0x03580...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF689BC035F napi_wrap+119615
 2: 00007FF689B67666 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NextTableOffset+38102
 3: 00007FF689B68466 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NextTableOffset+41686
 4: 00007FF68A3A451E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF68A38C6C1 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF68A23DE9C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF68A2490E0 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
 8: 00007FF68A245BF4 v8::internal::Heap::PageFlagsAreConsistent+3204
 9: 00007FF68A23B3F3 v8::internal::Heap::CollectGarbage+1283
10: 00007FF68A239A64 v8::internal::Heap::AddRetainedMap+2500
11: 00007FF68A25ADAD v8::internal::Factory::NewFillerObject+61
12: 00007FF689FBE381 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1665
13: 00007FF68A7F994D v8::internal::SetupIsolateDelegate::SetupHeap+546925
14: 000002DB0E4A4DF9
@PerryCodes PerryCodes added the v3 Version 3 of AutoRest C# generator. label Jun 28, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 28, 2024
@PerryCodes
Copy link
Author

Can an admin please remove the v3 label? I didn't realize that --legacy was bumping the version of autorest.csharp down to v2 until after posting this. Thanks.

@PerryCodes
Copy link
Author

Here's the spec I'm attempting to build a client for (Autotask PSA)
v1.json

I'm able to build clients fine without --legacy, however it doesn't seem to bother with models anymore. So then I tried the --generation1-convenience-client option. That built models, but also decided it wanted to scope internal all over the clients.

increase-memory-limit didn't help.

@lirenhe
Copy link
Member

lirenhe commented Jul 1, 2024

Could you try the customization to make clients internal?
https://github.com/Azure/autorest.csharp/blob/feature/v3/readme.md#make-a-client-internal

@ArcturusZhang ArcturusZhang added v2 Version 2 of AutoRest C# generator. and removed v3 Version 3 of AutoRest C# generator. labels Jul 1, 2024
@ArcturusZhang
Copy link
Member

Hi @PerryCodes --legacy should be using our v2 generator which has been retired for a long time.
node has some configuration which allows you to enlarge the heap, such as --max-old-space-size=4096. The OOM error might happen when your swagger is big.

But in general, our recommendation is to switch to the v3 generator, and if possible, switch to typespec.

@ArcturusZhang
Copy link
Member

Here's the spec I'm attempting to build a client for (Autotask PSA) v1.json

I'm able to build clients fine without --legacy, however it doesn't seem to bother with models anymore. So then I tried the --generation1-convenience-client option. That built models, but also decided it wanted to scope internal all over the clients.

increase-memory-limit didn't help.

So if you remove --legacy, only typespec input will generate models.
If you remove --legacy and add --generation1-convenience-client option, and you want the clients to be public, you could add another configuration --public-client with the --generation1-convenience-client. The public-client configuration should make your clients to be public by default.

@ArcturusZhang ArcturusZhang added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jul 1, 2024
Copy link
Contributor

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@microsoft-github-policy-service microsoft-github-policy-service bot added the no-recent-activity There has been no recent activity on this issue. label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that v2 Version 2 of AutoRest C# generator.
Projects
None yet
Development

No branches or pull requests

3 participants