EMFILE: too many open files error on windows with CDKTF
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 267
- Avg merge
- 1d 25m
- Merged PRs (30d)
- 14
Description
### Describe the bug
Dotnet fails with JSII-Pacmak: ` | [jsii-pacmak] [WARN] dotnet failed`
The full error is
```
NOTE: Temp directory retained due to an error: C:\TEMP\temp-nngPnl
Error: jsii compilation failed with non-zero exit code: 1
| [jsii-pacmak] [WARN] dotnet failed
| Error: EMFILE: too many open files, open 'C:\TEMP\temp-nngPnl\dist\dotnet\aws\aws\Wafv2RuleGroup\Wafv2RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeadersMatchPatternOutputReference.cs'
+----------------------------------------------------------------------------------
| Command: C:\Users\xxxxxxxx\AppData\Roaming\nvm\v18.12.1\node_modules\cdktf-cli\node_modules\jsii-pacmak\bin\jsii-pacmak --code-only
| Workdir: C:\TEMP\temp-nngPnl
+----------------------------------------------------------------------------------
at p (C:\Users\xxxxxxxx\AppData\Roaming\nvm\v18.12.1\node_modules\cdktf-cli\bundle\bin\cmds\handlers.js:52:1581)
at ChildProcess. (C:\Users\xxxxxxxx\AppData\Roaming\nvm\v18.12.1\node_modules\cdktf-cli\bundle\bin\cmds\handlers.js:55:112)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at ChildProcess.emit (node:domain:489:12)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
⠏ downloading and generating modules and providers...
jsii compilation failed with non-zero exit code: 1
| [jsii-pacmak] [WARN] dotnet failed
| Error: EMFILE: too many open files, open 'C:\TEMP\temp-nngPnl\dist\dotnet\aws\aws\Wafv2RuleGroup\Wafv2RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchHeadersMatchPatternOutputReference.cs'
+----------------------------------------------------------------------------------
| Command: C:\Users\xxxxxxxx\AppData\Roaming\nvm\v18.12.1\node_modules\cdktf-cli\node_modules\jsii-pacmak\bin\jsii-pacmak --code-only
| Workdir: C:\TEMP\temp-nngPnl
+----------------------------------------------------------------------------------
```
### Expected Behavior
jsii-pacmak should have created the dotnet bindings
### Current Behavior
EMFILE: too many open files error is thrown
### Reproduction Steps
On windows 10 run
```bash
npm install -g cdktf-cli@0.13.3
cdktf init --template=typescript --local # create a new project in an empty folder
cdktf provider add aws --force-local # this should throw the error
cdktf get # this can re-trigger the error
```
### Possible Solution
_No response_
### Additional Information/Context
This is the [original issue](https://github.com/hashicorp/terraform-cdk/issues/2296) raised by @msavidg with all the original information
### SDK version used
1.68.0
### Environment details (OS name and version, etc.)
win32 10.0.19044
Contributor guide
Research direction
Reproduce on Windows 10 with the listed cdktf-cli commands, then start at the jsii-pacmak --code-only invocation and its generated dotnet output. Done means cdktf provider add or cdktf get completes without EMFILE and creates the dotnet bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100