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

"Error: EAGAIN: resource temporarily unavailable, read" when using --standard-json flag #460

Open
jcaracciolo opened this issue Apr 9, 2020 · 4 comments

Comments

@jcaracciolo
Copy link

jcaracciolo commented Apr 9, 2020

When trying to use the command line with the flag --standard-json, the following error is thrown

solcjs --standard-json Example.json
internal/fs/utils.js:230
    throw err;
    ^

Error: EAGAIN: resource temporarily unavailable, read
    at Object.readSync (fs.js:537:3)
    at tryReadSync (fs.js:352:20)
    at Object.readFileSync (fs.js:389:19)
    at Object.<anonymous> (/usr/lib/node_modules/solc/solcjs:37:18)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  errno: -11,
  syscall: 'read',
  code: 'EAGAIN'
}
@chriseth
Copy link
Contributor

This looks like access to an imported file is failing. Which filesystem are you using and what is the path your are importing?

@jcaracciolo
Copy link
Author

This was tested on two different Ubuntu 18 machines, both accesing a typical file. Note that the solc compiler does work. Running solc --standard-json example.json succesfully outputs the result, while solcjs --standard-json example.json (on the same file) ends up in the error shown above.

The same issue appears whether solcjs is installed globally or locally on a project.

@JackVCurtis
Copy link

JackVCurtis commented Feb 21, 2021

Hey, this appears to be related to this git issue: nodejs/node#7439 (Edit: okay, old node version, but an issue with the same API. I'm seeing this on OSX as well). See

solc-js/solcjs

Line 60 in e38dbe7

var input = fs.readFileSync(process.stdin.fd).toString('utf8');
. I'd be happy to work on a fix if I can get an agreement on the approach.

@cameel
Copy link
Member

cameel commented Oct 6, 2021

@JackVCurtis What's your suggested approach?

The "right" way to read from stdin in node.js seems to read data in chunks using process.stdin.read() so the solution would be to create a small helper for doing that until it gets the whole file. There's probably no point in doing anything asynchronous here since the compiler needs the whole input in one go anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Design/Decide
Development

No branches or pull requests

4 participants