question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting "Error: EOF: end of file, read" on Windows

See original GitHub issue

description of the bug:

returns JSII error on empty stack. May be related to https://github.com/aws/aws-cdk/issues/5187.

stack trace references SyncStdio.readLine (myfolder\jsii_embedded\jsii\jsii-runtime.js:13278:33) Comment in code at ‘throw e’:

// HACK: node may set O_NONBLOCK on it's STDIN depending on what kind of input it is made
// of (see https://github.com/nodejs/help/issues/2663).
. . .
// "tracked" at https://github.com/aws/aws-cdk/issues/5187

Reproduction Steps

(using powershell) This follows example from https://docs.aws.amazon.com/cdk/latest/guide/ecs_example.html
mkdir myfolder
cd myfolder
cdk init --language python
.env\Scripts\activate.ps1
python -m pip install -r requirements.txt
cdk synth

What did you expect to happen?

return an empty stack with no error

What actually happened?

(.env) p$[myfolder]> cdk synth                                                                                                                      D:\d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13295
                    throw e;
                    ^

Error: EOF: end of file, read
    at Object.readSync (fs.js:592:3)
    at SyncStdio.readLine (D:\d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13278:33)
    at InputOutput.read (D:\d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13203:34)
    at KernelHost.run (D:\d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13021:32)
    at Immediate.<anonymous> (D:\d:\myfolder\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13029:37)
    at processImmediate (internal/timers.js:461:21) {
  errno: -4095,
  syscall: 'read',
  code: 'EOF'
}
Resources:
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Modules: aws-cdk=1.69.0,@aws-cdk/cloud-assembly-schema=1.69.0,@aws-cdk/core=1.69.0,@aws-cdk/cx-api=1.69.0,@aws-cdk/region-info=1.69.0,jsii-runtime=Python/3.7.4
    Metadata:
      aws:cdk:path: myfolder/CDKMetadata/Default
    Condition: CDKMetadataAvailable

Environment

  • CLI Version : aws-cli/2.0.61 Python/3.7.7 Windows/10 exe/AMD64
  • Framework Version: 1.69.0 (build 2b474b9)
  • Node.js Version: v14.15.0
  • OS : Windows 10
  • Language (Version): python 3.7.4

Other

Error is persistent and easily reproduced on my machine. I re-installed/upgraded aws cli to 2.0.61 I re-installed node.js I re-installed cdk Note: As noted in the section above, this ‘hello world’ level error still creates a stack. However, when more code is added, more jsii errors occur and the stack fails. Also, code that errors on my machine runs normally on other machines.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ot-jim-elphickcommented, Nov 9, 2020

@RomainMuller Workaround: replace jsii 1.14.x distro in site-packages with 1.12 or 1.13 distro. After swap, errors stop.

TL;DR I was able to swap out the 1.14.1 distro in the site-packages for the jsii 1.12 distro. Same code that consistently threw the error reported above, now runs with no errors. This behavior corresponds to the the reports from other devs (where I got the jsii 1.12 distro) that they had no issues with the code.

Rolling back node.js or cdk to earlier versions had no effect because pip install - r requirements.txt always installed the 1.14.x distro.

Longer term fix: move dev platform from Windows to linux.

0reactions
github-actions[bot]commented, Jun 21, 2022

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reaching EOF before end of file on windows - Stack Overflow
Firstly, binary files should be opened with binary mode. This means you should use "rb" and "wb" for fopen() mode instead of "r"...
Read more >
Input past end of file (Error 62) - Microsoft Learn
An Input # or Line Input # statement is reading from a file in which all data has been read or from an...
Read more >
EOF Failure When Reading File - 272569
When trying to do read a .csv file I keep getting: Error Number 20010: Error File Pointer Has Reached The End Of File...
Read more >
SyntaxError Unexpected EOF While Parsing Python Error ...
The first thing to understand is what the error message means. EOF stands for End of File in Python. Unexpected EOF implies that...
Read more >
Handling end-of-file (eof) correctly
The eof() function, as in infile.eof() , is a bool function which is true if the EOF character has been read, false otherwise....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found