Code Monkey home page Code Monkey logo

Comments (12)

arturadib avatar arturadib commented on May 23, 2024

Hey sorry I don't have a Debian box to diagnose this -- would love a little help :)

from shelljs.

protz avatar protz commented on May 23, 2024

Ok, so just in case you happen to have a friend running Debian:

sudo apt-get install nodejs
sudo apt-get install npm
npm install shelljs

The lines above still trigger the issue.

strace tells me that the nodejs process is stuck in a loop:

stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
pwrite(5, "a", 1, 0)                    = 1
close(5)                                = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
pwrite(5, "a", 1, 0)                    = 1
close(5)                                = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
pwrite(5, "a", 1, 0)                    = 1
close(5)                                = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC)           = 0
pwrite(5, "a", 1, 0)                    = 1
close(5)

Let me know if I can do anything else.

from shelljs.

arturadib avatar arturadib commented on May 23, 2024

It seems to be a problem with the temporary files created by the execSync function (this function uses a temp-file monitoring hack to detect when an external process has ended). Perhaps the process doesn't have the right permissions to write to /tmp?

Here's the relevant part that sets the temp file names: https://github.com/arturadib/shelljs/blob/master/shell.js#L1730-L1734

And here's the part that loops until the temp files are created (i.e. after the external process has finished): https://github.com/arturadib/shelljs/blob/master/shell.js#L1778-L1783

If you have time to narrow down the problem in this execSync function that'd be superb :)

from shelljs.

protz avatar protz commented on May 23, 2024

I don't think it's a write permission problem; this is my laptop, I can write files to /tmp, and there are indeed a couple makerjs_* files hanging around in /tmp.

I'm not a nodejs hacker (I don't even know where the shelljs files got installed) so I can't promise anything; besides, I've got a deadline for a conference looming, but I may be able to look into this in a couple weeks.

Thanks for the ping!

jonathan

from shelljs.

protz avatar protz commented on May 23, 2024

Forgot to mention that one of the two files is just the single
character "a" while the other one seems to be a well-formed js file.

On Wed 20 Mar 2013 02:32:56 PM CET, Artur Adib wrote:

It seems to be a problem with the temporary files created by the
|execSync| function (this function uses a temp-file monitoring hack to
detect when an external process has ended). Perhaps the process
doesn't have the right permissions to write to |/tmp|?

Here's the relevant part that sets the temp file names:
https://github.com/arturadib/shelljs/blob/master/shell.js#L1730-L1734

And here's the part that loops until the temp files are created (i.e.
after the external process has finished):
https://github.com/arturadib/shelljs/blob/master/shell.js#L1778-L1783

If you have time to narrow down the problem in this |execSync|
function that'd be superb :)


Reply to this email directly or view it on GitHub
#51 (comment).

from shelljs.

jessesherlock avatar jessesherlock commented on May 23, 2024

No movement on this? I have the exact same issue. Strace is spitting out:

stat("/tmp/shelljs_9571547baab5cf1a38b3", 0x7fffcb1083f8) = -1 ENOENT (No such file or directory)
open("/tmp/shelljs_5551a876f0699f0863c2", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 11
pwrite(11, "a", 1, 0) = 1
close(11)

over and over, while using 100% CPU.

The files are as follows:
stdoutFile: /tmp/shelljs_ba0d754beae800fb26e6
codeFile: /tmp/shelljs_9571547baab5cf1a38b3
scriptFile: /tmp/shelljs_c8142a779ed3d2169974
sleepFile: /tmp/shelljs_5551a876f0699f0863c2

and the files that exist are:
ll /tmp/shelljs_*
-rw-r--r-- 1 ____ users 0 Jun 25 15:33 /tmp/shelljs_5551a876f0699f0863c2
-rw-r--r-- 1 ____ users 341 Jun 25 15:27 /tmp/shelljs_c8142a779ed3d2169974

So it's the very first busy loop (that checks for codeFile) that is failing.

--- 10 minutes later ---

I got shell.js to spit out the value of process.execPath and it was .../zepto/node_modules/coffee-script/bin/coffee (I am trying to build zepto obviously). This fails with a syntax error trying to run js and the execSync hack gets stuck in a loop.

Manually running "node /tmp/shelljs_c8142a779ed3d2169974" in another terminal got it out of the loop.

I'm not sure if this is improper usage of shelljs by zepto or if shell.js shouldn't rely on process.execPath being "node".

Is this just a workaround for that odd Ubuntu bug where there was another program named node? (#50) and node gets called nodejs?

If that's the only reason I'm not sure this is the right approach, that's a $PATH problem that ubuntu users have. Not that I know what the right answer is here, but the combination of this temp-file hack and trying to fix common path problems in Ubuntu to help your users is a recipe for a lot of corner case problems.

from shelljs.

parasyte avatar parasyte commented on May 23, 2024

We just hit this bug over in melonjs/melonJS#528

Wouldn't the busy IO loop be better implemented with fs.watch? My poor CPU...

In any case, we're going to switch to async exec, and hopefully that will resolve this for us. We'll just have to wrap our commands in an async series. 😒

from shelljs.

arturadib avatar arturadib commented on May 23, 2024

we need to implement the fresh new execSync in Node http://strongloop.com/strongblog/whats-new-in-node-js-v0-12-execsync-a-synchronous-api-for-child-processes/

anyone? =)

from shelljs.

nfischer avatar nfischer commented on May 23, 2024

@protz @parasyte @infracanophile Sorry for the delay! Any luck on this? Does the issue persist in shelljs v0.6? If so, which versions of node are you seeing the issue on?

from shelljs.

parasyte avatar parasyte commented on May 23, 2024

@nfischer I have already rewritten my shelljs calls to run asynchronously, and chained them with promises. I could experiment with reverting that.

from shelljs.

nfischer avatar nfischer commented on May 23, 2024

@parasyte thanks!

from shelljs.

nfischer avatar nfischer commented on May 23, 2024

Closing this, due to lack of inactivity. If this is still an issue, please ping this thread.

from shelljs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.