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

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #18411

Closed
pocesar opened this issue Sep 12, 2017 · 43 comments
Closed
Assignees
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified

Comments

@pocesar
Copy link

pocesar commented Sep 12, 2017

TypeScript Version: nightly (2.6.0-dev.20170912)

Code

{
  "compilerOptions": {
    "module": "system",
    "jsx": "react",
    "target": "es5",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "newLine": "lf",
    "allowJs": false,
    "noImplicitAny": true,
    "baseUrl": "./",
    "noEmitOnError": true,
    "sourceMap": true,
    "alwaysStrict": true,
    "inlineSourceMap": false,
    "paths": {
      "*": [
        "node_modules/@types/*"
      ]
    },
    "lib": [
      "dom",
      "es2015",
      "es5"
    ]
  }
}
07:28:49 - File change detected. Starting incremental compilation...



<--- Last few GCs --->

[1592:000002842FE68000]  7027823 ms: Mark-sweep 1401.5 (1465.4) -> 1401.5 (1465.4) MB, 4599.6 / 0.0 ms  last resort


<--- JS stacktrace --->

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

Security context: 0000033CF2C1CEA9 <JSObject>
    1: set [native collection.js:~247] [pc=000000C2A8FE6697](this=000000F425FBE6F1 <Map map = 000003AA6FD983B9>,p=000003A9ED17AB21
<String[9]: @Telefone>,x=000003A9ED17AB51 <Type map = 000003AA6FDC6CF9>)
    2: getLiteralType(aka getLiteralType) [C:\nodejs\node_modules\typescript\lib\tsc.js:~24883] [pc=000000C2A8D93E76](this=0000033C
F2C02241 <undefined>,value=000000CEC1A9C961 <String[8]: Telef...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Expected behavior:

Not crash

Actual behavior:

TS in watch mode is randomly crashing with the above stacktrace. I can't figure out what is making it crash. I'm using vscode, but the watch mode is tsc -w -p tsconfig.json

per @sandersn recommendation (in #17112 (comment)) opening a new issue about the same error name, but different stack

@mhegazy
Copy link
Contributor

mhegazy commented Sep 12, 2017

@pocesar can you share your sources with us? we are open to do this by email, or sign any required NDAs.

@mhegazy mhegazy added Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified labels Sep 12, 2017
@sandersn
Copy link
Member

Can you also try --diagnostics to see how many types are being created when compilation does succeed?

@pocesar
Copy link
Author

pocesar commented Sep 12, 2017

just crashed with another stacktrace

13:38:16 - File change detected. Starting incremental compilation...



<--- Last few GCs --->

[13348:000001CC04D09180]  8048988 ms: Mark-sweep 1403.5 (1469.2) -> 1403.5 (1469.2) MB, 3311.7 / 0.0 ms  last resort


<--- JS stacktrace --->

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

Security context: 000002E66029CEA9 <JSObject>
    1: getTypeReferenceId(aka getTypeReferenceId) [C:\nodejs\node_modules\typescript\lib\tsc.js:~26377] [pc=0000014DCA819BD0](this=
000002E660282241 <undefined>,type=000002FC83FFBC51 <Type map = 0000008AEC429EF9>,typeParameters=00000388F03E8951 <JSArray[1]>,depth
=000002E660282241 <undefined>)
    2: arguments adaptor frame: 2->3
    3: getRelationKey(aka getRelationKey) [C:\nodejs\node_modules\...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
The terminal process terminated with exit code: 3

Terminal will be reused by tasks, press any key to close it.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 12, 2017

The stack trace is inconsequential here. the process runs out of memory, it does not really matter where it crashes, what matters is why is it filling up memory.

@pocesar
Copy link
Author

pocesar commented Sep 12, 2017

Files:           121
Lines:         64003
Nodes:        261277
Identifiers:   88809
Symbols:      136598
Types:         34024
Memory used: 146529K
I/O read:      0.85s
I/O write:     0.04s
Parse time:    2.95s
Bind time:     1.58s
Check time:    5.19s
Emit time:     1.21s
Total time:   10.92s
14:09:01 - Compilation complete. Watching for file changes.

it will crash again in a couple of minutes, I'll see if anything changes

@mhegazy
Copy link
Contributor

mhegazy commented Sep 12, 2017

so it does not crash without --watch?

@pocesar
Copy link
Author

pocesar commented Sep 12, 2017

so far I've been able to build without watch, but when using -w it randomly crashes after a couple of compilations

14:24:33 - File change detected. Starting incremental compilation...


Files:           121
Lines:         64003
Nodes:        261277
Identifiers:   88809
Symbols:      136598
Types:         34024
Memory used: 197127K
I/O read:      0.01s
I/O write:     0.01s
Parse time:    1.15s
Bind time:     0.02s
Check time:    5.19s
Emit time:     0.95s
Total time:    7.31s
14:24:41 - Compilation complete. Watching for file changes.


14:42:00 - File change detected. Starting incremental compilation...


Files:           121
Lines:         64004
Nodes:        261277
Identifiers:   88809
Symbols:      136598
Types:         34024
Memory used: 242675K
I/O read:      0.00s
I/O write:     0.02s
Parse time:    0.60s
Bind time:     0.02s
Check time:    4.27s
Emit time:     0.74s
Total time:    5.62s
14:42:05 - Compilation complete. Watching for file changes.

the memory is ever increasing though

@mhegazy
Copy link
Contributor

mhegazy commented Sep 12, 2017

aah.. that indicates there is a memory leak for --watch. do you see this with other projects?

@mhegazy mhegazy assigned sheetalkamat and unassigned sandersn Sep 12, 2017
@pocesar
Copy link
Author

pocesar commented Sep 12, 2017

yes, it usually reaches a point where my machine slows to a crawl, and even vscode crashes (because I have 5 editors opened, all with TSC with watch, using nightly for all of them, even for vscode)

Files:           121
Lines:         64004
Nodes:        261277
Identifiers:   88809
Symbols:      136598
Types:         34024
Memory used: 329374K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.84s
Bind time:     0.02s
Check time:    3.48s
Emit time:     0.61s
Total time:    4.95s
15:25:30 - Compilation complete. Watching for file changes.

@taoqf
Copy link

taoqf commented Sep 13, 2017

try this:
node --max-old-space-size=4096 ./node_modules/.bin/tsc
may work for you.

@pocesar
Copy link
Author

pocesar commented Sep 13, 2017

the problem is that there is a leak, no matter how big it is set, the memory reaches the maximum set point then crashes

using node 8.5.0 now, and 2.6.0-dev.20170913, fresh "tsc -p tsconfig.json -w"

Files:           120
Lines:         64046
Nodes:        261636
Identifiers:   88911
Symbols:      136761
Types:         34005
Memory used: 139193K
I/O read:      0.04s
I/O write:     0.00s
Parse time:    1.98s
Bind time:     1.37s
Check time:    4.04s
Emit time:     0.00s
Total time:    7.39s
07:01:30 - Compilation complete. Watching for file changes.


07:09:45 - File change detected. Starting incremental compilation...


Files:           120
Lines:         64046
Nodes:        261639
Identifiers:   88912
Symbols:      136761
Types:         34005
Memory used: 194918K
I/O read:      0.00s
I/O write:     0.04s
Parse time:    0.62s
Bind time:     0.02s
Check time:    5.28s
Emit time:     0.88s
Total time:    6.79s
07:09:52 - Compilation complete. Watching for file changes.

@BANG88
Copy link

BANG88 commented Sep 14, 2017

Same error here .

@pocesar
Copy link
Author

pocesar commented Sep 17, 2017

using 2.6.0-dev.20170916

Files:           120
Lines:         64078
Nodes:        261577
Identifiers:   88872
Symbols:      136833
Types:         34032
Memory used: 416321K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.49s
Bind time:     0.00s
Check time:    4.14s
Emit time:     0.00s
Total time:    4.63s
11:54:15 - Compilation complete. Watching for file changes.


11:54:20 - File change detected. Starting incremental compilation...


Files:           120
Lines:         64078
Nodes:        261577
Identifiers:   88872
Symbols:      136833
Types:         34032
Memory used: 479510K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.38s
Bind time:     0.01s
Check time:    3.68s
Emit time:     0.51s
Total time:    4.59s
11:54:25 - Compilation complete. Watching for file changes.


Files:           120
Lines:         64078
Nodes:        261577
Identifiers:   88872
Symbols:      136833
Types:         34032
Memory used: 582448K
I/O read:      0.00s
I/O write:     0.02s
Parse time:    0.54s
Bind time:     0.00s
Check time:    3.12s
Emit time:     1.45s
Total time:    5.11s
11:59:53 - Compilation complete. Watching for file changes.

@mceachen
Copy link

Same error here, with tsc -w, and sometimes only after two or three recompiles. ~50kloc codebase.

@icopp
Copy link

icopp commented Sep 20, 2017

I've encountered this reliably when trying to use the latest commit on facebook/immutable-js as a dependency.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 20, 2017

@icopp i think this is a different issue. can you try with typescript@next instead.

@pocesar
Copy link
Author

pocesar commented Sep 21, 2017

still happening in 20170920

Files:           121
Lines:         64270
Nodes:        263129
Identifiers:   89338
Symbols:      137402
Types:         34249
Memory used: 144834K
I/O read:      0.77s
I/O write:     0.04s
Parse time:    4.57s
Bind time:     1.40s
Check time:    4.28s
Emit time:     1.18s
Total time:   11.43s
15:31:54 - Compilation complete. Watching for file changes.


16:05:01 - File change detected. Starting incremental compilation...

Files:           121
Lines:         64245
Nodes:        262884
Identifiers:   89180
Symbols:      137557
Types:         34314
Memory used: 187122K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.62s
Bind time:     0.06s
Check time:    3.83s
Emit time:     0.00s
Total time:    4.51s
16:05:05 - Compilation complete. Watching for file changes.

should I stop reporting the same behavior on nightlies until #17269 gets merged?

@mhegazy
Copy link
Contributor

mhegazy commented Sep 21, 2017

should I stop reporting the same behavior on nightlies until #17269 gets merged?

yes please.

@pocesar
Copy link
Author

pocesar commented Oct 2, 2017

just a heads up, it's really hard to have multiple watches on a project that is split in many shared codebases:

image

in my scenario: I have two projects that are symlinked to the main projects (one for typings and other for shared ui stuff). every time there's a save, the memory increases until it crashes.

although I have 5 running TS in watch mode, all together are draining 53% of my total RAM (i'm near 93% used RAM at the moment). this is really a huge issue that should be addressed ASAP, it's really hindering the workflow

@mceachen
Copy link

mceachen commented Oct 3, 2017

@pocesar I'm limping along by retaining the default small heap size, letting tsc crash, and restarting automatically:

 while [ 1 ] ; do yarn clean ; yarn tsc -w ; sleep 1 ; done

(the sleep 1 makes ctrl-c a bit more receptive in git-bash on windows)

@mhegazy
Copy link
Contributor

mhegazy commented Oct 3, 2017

#17269 should be in typescript@next as of today. can you give it a try and let us know if you are still seeing leaks?

@mceachen
Copy link

mceachen commented Oct 3, 2017

Thanks, @mhegazy

I'm looking at three pages of compiler warning/errors from 2.6 (that compiled successfully with strict mode in 2.5.3). It looks like it's mainly in third-party typings, so it'll take some time to get that sorted.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 3, 2017

--strict in 2.6 adds a new --strictFunctionTypes, setting this to false should return you to the 2.5.3 --strict behavior.

@pocesar
Copy link
Author

pocesar commented Oct 5, 2017

nope, it even made it worse, the watcher now starts nearly 1GB of RAM each, and each save ramps up. using 20171005

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144235
Types:         35618
Memory used: 960687K
I/O read:      0.06s
I/O write:     0.77s
Parse time:    3.60s
Bind time:     1.54s
Check time:    5.08s
Emit time:    32.99s
Total time:   43.21s
05:49:07 - Compilation complete. Watching for file changes.

05:50:25 - File change detected. Starting incremental compilation...


Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 214401K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.01s
Bind time:     0.02s
Check time:    4.63s
Emit time:     0.92s
Total time:    5.58s
05:50:31 - Compilation complete. Watching for file changes.

05:50:31 - File change detected. Starting incremental compilation...

Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 274874K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.01s
Bind time:     0.01s
Check time:    2.42s
Emit time:     0.67s
Total time:    3.11s
05:50:34 - Compilation complete. Watching for file changes.

05:50:38 - File change detected. Starting incremental compilation...

Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 352095K
I/O read:      0.00s
I/O write:     0.02s
Parse time:    0.01s
Bind time:     0.01s
Check time:    2.55s
Emit time:     0.59s
Total time:    3.15s
05:50:41 - Compilation complete. Watching for file changes.

05:50:41 - File change detected. Starting incremental compilation...

Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 426715K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.01s
Bind time:     0.00s
Check time:    2.35s
Emit time:     0.57s
Total time:    2.93s
05:50:44 - Compilation complete. Watching for file changes.

05:50:44 - File change detected. Starting incremental compilation...

Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 499230K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.01s
Bind time:     0.00s
Check time:    2.65s
Emit time:     0.59s
Total time:    3.25s
05:50:48 - Compilation complete. Watching for file changes.

05:50:48 - File change detected. Starting incremental compilation...

Synchronizing program

Files:           121
Lines:         64990
Nodes:        265759
Identifiers:   90158
Symbols:      144236
Types:         35615
Memory used: 570233K
I/O read:      0.00s
I/O write:     0.01s
Parse time:    0.01s
Bind time:     0.00s
Check time:    2.44s
Emit time:     0.55s
Total time:    3.00s

05:50:51 - Compilation complete. Watching for file changes.

@sheetalkamat
Copy link
Member

@pocesar Wanted to make sure you are using the latest build. While i tried to repro this on larger code base, I noticed that in --diagnostics mode there is too much logging on the command line. Did you notice that? (The fix for that would be in PR #18970). Also I did not see explosion in memory. The memory usage is more than previous version but memory isn't leaking and is being collected.
Ex here are the memory numbers I saw on few larger code bases:

Synchronizing program

Files:          5010
Lines:        302718
Nodes:       1124917
Identifiers:  358857
Symbols:      449513
Types:        128493
Memory used: 885844K
I/O read:      0.68s
I/O write:     7.36s
Parse time:   18.20s
Bind time:     1.14s
Check time:   10.79s
Emit time:    13.72s
Total time:   43.85s
11:43:57 - Compilation complete. Watching for file changes.

Files:          5010
Lines:        302718
Nodes:       1124925
Identifiers:  358859
Symbols:      182359
Types:           543
Memory used: 888615K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.34s
Bind time:     0.01s
Check time:    0.12s
Emit time:     0.06s
Total time:    0.52s
11:45:00 - Compilation complete. Watching for file changes.

Files:          5010
Lines:        302718
Nodes:       1124917
Identifiers:  358857
Symbols:      182358
Types:           541
Memory used: 889869K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.28s
Bind time:     0.01s
Check time:    0.03s
Emit time:     0.04s
Total time:    0.36s
11:45:26 - Compilation complete. Watching for file changes.

Files:          5010
Lines:        302718
Nodes:       1124921
Identifiers:  358858
Symbols:      182361
Types:           545
Memory used: 633818K
I/O read:      0.00s
I/O write:     0.00s
Parse time:    0.24s
Bind time:     0.01s
Check time:    0.03s
Emit time:     0.05s
Total time:    0.33s
11:46:38 - Compilation complete. Watching for file changes.

@pocesar
Copy link
Author

pocesar commented Oct 5, 2017

@sheetalkamat yes, I noticed (and missing some new lines, the output is kinda raw and unformatted). I'm almost sure that the problem is happening because I use npm link (two sub projects being watched as the same time as the main project). Windows is really bad when it comes to symlinks, and I can repro the memory increase every single time until it crashes. That's the only "special" reason I can think of (there are also other issues that I reported that has to do with symlinks in windows)

@sheetalkamat
Copy link
Member

@pocesar i will give it a shot with npm link to see if i am able to repro the memory running out issue to investigate this further

@sheetalkamat
Copy link
Member

@pocesar I tried the npm link option and it seem to work ok for me. I am wondering if it would be possible for you to share your code with exact steps (what to npm install/ what to npm link) either here or privately on email (shkamat@microsoft.com) for me to be able to investigate this futher

@shepmaster
Copy link

I am experiencing this when trying to upgrade from 2.4.2, including to typescript@2.7.0-dev.20171025. I ran yarn run tsc --diagnostics, but there's no extra output beyond the not-that-useful stack trace. The WIP branch is available, but is there any other details I can gather?

not-that-useful stack trace
<--- Last few GCs --->

[50429:0x104001c00]    34337 ms: Mark-sweep 1403.5 (1461.0) -> 1403.5 (1461.0) MB, 2472.2 / 0.0 ms  allocation failure GC in old space requested
[50429:0x104001c00]    36941 ms: Mark-sweep 1403.5 (1461.0) -> 1403.5 (1436.5) MB, 2603.9 / 0.0 ms  last resort GC in old space requested
[50429:0x104001c00]    39527 ms: Mark-sweep 1403.5 (1436.5) -> 1403.5 (1436.0) MB, 2585.5 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0x2c0da4325e71 <JSObject>
    1: bindJSDocTypedefTagIfAny(aka bindJSDocTypedefTagIfAny) [/Users/shep/Projects/integer32/playground/ui/frontend/node_modules/typescript/lib/tsc.js:~16852] [pc=0x3d8e724dfe4b](this=0x2c0d4fc02311 <undefined>,node=0x2c0d36e4b539 <Node map = 0x2c0dd23f3011>)
    2: bind(aka bind) [/Users/shep/Projects/integer32/playground/ui/frontend/node_modules/typescript/lib/tsc.js:~16826] [pc=0x3d8e724a5d3...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/usr/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
 5: v8::internal::Factory::NewByteArray(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
 6: v8::internal::TranslationBuffer::CreateByteArray(v8::internal::Factory*) [/usr/local/bin/node]
 7: v8::internal::compiler::CodeGenerator::PopulateDeoptimizationData(v8::internal::Handle<v8::internal::Code>) [/usr/local/bin/node]
 8: v8::internal::compiler::CodeGenerator::FinalizeCode() [/usr/local/bin/node]
 9: void v8::internal::compiler::PipelineImpl::Run<v8::internal::compiler::FinalizeCodePhase>() [/usr/local/bin/node]
10: v8::internal::compiler::PipelineImpl::FinalizeCode() [/usr/local/bin/node]
11: v8::internal::compiler::PipelineCompilationJob::FinalizeJobImpl() [/usr/local/bin/node]
12: v8::internal::CompilationJob::FinalizeJob() [/usr/local/bin/node]
13: v8::internal::Compiler::FinalizeCompilationJob(v8::internal::CompilationJob*) [/usr/local/bin/node]
14: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions() [/usr/local/bin/node]
15: v8::internal::StackGuard::HandleInterrupts() [/usr/local/bin/node]
16: v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
17: 0x3d8e7210463d

@sheetalkamat
Copy link
Member

@shepmaster I tried to reproduce the issue with and without --watch and I am able to build without running into the trace you mentioned. Am I missing something.. I did verify that the tsc version I am running this with is

c:\temp\rust-playground\ui\frontend>c:\temp\rust-playground\ui\frontend\node_modules\.bin\tsc --v
Version 2.7.0-dev.20171025
c:\temp\rust-playground\ui\frontend> yarn run tsc --diagnostics
yarn run v1.2.0
$ c:\temp\rust-playground\ui\frontend\node_modules\.bin\tsc --diagnostics
error TS5055: Cannot write file 'c:/temp/rust-playground/ui/frontend/postcss.config.js' because it would overwrite input file.
error TS5055: Cannot write file 'c:/temp/rust-playground/ui/frontend/webpack.config.js' because it would overwrite input file.
Files:            74
Lines:         43125
Nodes:        189422
Identifiers:   64813
Symbols:      113010
Types:         22529
Memory used: 121082K
I/O read:      0.01s
I/O write:     0.01s
Parse time:    0.62s
Bind time:     0.34s
Check time:    1.67s
Emit time:     0.13s
Total time:    2.76s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

c:\temp\rust-playground\ui\frontend>c:\temp\rust-playground\ui\frontend\node_modules\.bin\tsc --v
Version 2.7.0-dev.20171025

c:\temp\rust-playground\ui\frontend> yarn run tsc --diagnostics --w
yarn run v1.2.0
$ c:\temp\rust-playground\ui\frontend\node_modules\.bin\tsc --diagnostics --w
Synchronizing program
error TS5055: Cannot write file 'c:/temp/rust-playground/ui/frontend/postcss.config.js' because it would overwrite input file.
error TS5055: Cannot write file 'c:/temp/rust-playground/ui/frontend/webpack.config.js' because it would overwrite input file.
Files:            74
Lines:         43125
Nodes:        189422
Identifiers:   64813
Symbols:      112685
Types:         21470
Memory used: 128108K
I/O read:      0.01s
I/O write:     0.05s
Parse time:    0.66s
Bind time:     0.35s
Check time:    1.61s
Emit time:     0.24s
Total time:    2.87s
15:40:06 - Compilation complete. Watching for file changes.

@mhegazy mhegazy added this to the TypeScript 2.6.1 milestone Oct 25, 2017
@shepmaster
Copy link

@sheetalkamat interesting! The biggest difference I can see is that you are using Windows while I am using macOS (10.12.6). I am also using Node v8.7.0. My computer has 16GB of RAM, and watching the memory usage of the node process, I only see it get to about 1.4GB. Any other environmental aspects that you are aware of that might come into play?

@sheetalkamat
Copy link
Member

@shepmaster Are you seeing issue only when doing tsc --watch or even without watch? I used computer with 16GB ram too.. node version is v8.6.0

@shepmaster
Copy link

shepmaster commented Oct 26, 2017

Are you seeing issue only when doing tsc --watch or even without watch?

@sheetalkamat I am seeing it even without --watch. One thing I did notice is that also I see this behavior with only upgrading ts-loader. When I was originally doing this set of upgrades, I noticed a slowdown when I upgraded ts-loader, but then ran out of memory when upgrading TypeScript. It's possible that TS 2.5+ uses a bit more memory than 2.4 (which sounds like a known issue) and something about ts-loader 3.x uses a lot more memory and the combination of the two of them caused running out of memory.

I don't know how having upgraded ts-loader would affect the performance of tsc though, even when not directly invoking webpack.

@shepmaster
Copy link

Are the warnings like

error TS5055: Cannot write file 'c:/temp/rust-playground/ui/frontend/postcss.config.js' because it would overwrite input file.

Normal / to be expected? It seems strange that there's some kind of configuration that would be overwriting input files...

In fact, when I add some options to extend the memory available (node --max-old-space-size=8192 /Users/shep/Projects/integer32/playground/ui/frontend/node_modules/.bin/tsc), I get a lot of errors:

error TS5055: Cannot write file '/Users/shep/Projects/integer32/playground/ui/frontend/build/assets/manifest-f92a2fa07a675799acdf.js' because it would overwrite input file.
error TS5055: Cannot write file '/Users/shep/Projects/integer32/playground/ui/frontend/build/assets/manifest-fae5d6465c73b7dba2a5.js' because it would overwrite input file.
error TS5055: Cannot write file '/Users/shep/Projects/integer32/playground/ui/frontend/build/assets/manifest-fbeebc437ed33ba9cb03.js' because it would overwrite input file.
error TS5055: Cannot write file '/Users/shep/Projects/integer32/playground/ui/frontend/build/assets/manifest-fd16a06130fa46122d18.js' because it would overwrite input file.

Perhaps I have some poor configuration that is reading my output directory as input files... In fact, I have 65M of output files, which might be triggering #17112. I'll see if I can adjust my configuration to properly ignore output files. This might explain why you don't see the same problem — you don't have the same old build artifacts laying around that I do.

@electricessence
Copy link

Just a note... This error still happens for me in 2.7.0-dev.20171027.
I have to revert to 2.3.2 for my code to compile (and it does effortlessly).

@mhegazy
Copy link
Contributor

mhegazy commented Oct 30, 2017

@electricessence can you share the project

@electricessence
Copy link

electricessence commented Nov 1, 2017

@mhegazy https://github.com/electricessence/TypeScript.NET

The project compiles in Webstorm for the existing tsconfigs with 2.7. But I'm dependent on gulp to render my distributions and run tests. The area where it gets problematic is in /source/System.Linq where the Linq.ts lib tries to reconcile the extensive interface signature. If I rip out the guts of the interface, it will compile (although still quite slowly relative to 2.3.2)

@mhegazy
Copy link
Contributor

mhegazy commented Nov 1, 2017

@electricessence seems like a separate issue..

@mhegazy
Copy link
Contributor

mhegazy commented Nov 1, 2017

--noStrictGenericChecks should get you going in the time being.

@mhegazy
Copy link
Contributor

mhegazy commented Nov 1, 2017

filed #19662 to track that one.

@electricessence
Copy link

Ok I will try --noStrictGenericChecks

@mhegazy
Copy link
Contributor

mhegazy commented Nov 9, 2017

closing for now. please reopen if you are still running into issues.

@mhegazy mhegazy closed this as completed Nov 9, 2017
@electricessence
Copy link

I'm following it on #19662,

@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

10 participants