SyntaxError: Unexpected end of input #114

Closed
davidaparicio opened this Issue May 28, 2012 · 13 comments

Projects

None yet

3 participants

@davidaparicio
The Garden member

Hi,

With the last version of tree, I have this error on TheFileTree.org
node.log file:

undefined:0
^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at /home/dom/tree/lib/driver.js:64:26
    at [object Object].<anonymous> (fs.js:115:5)
    at [object Object].emit (events.js:64:17)
    at afterRead (fs.js:1117:12)
    at Object.wrapper [as oncomplete] (fs.js:254:17)
CA file not found: https.ca
info: socket.io started
@espadrine espadrine was assigned May 28, 2012
@espadrine
The Garden member
@jankeromnes
The Garden member

I confirm I've definitely seen this, don't know how to reproduce though.

@espadrine
The Garden member
@jankeromnes
The Garden member

Just reproduced. It happens after a deluge of EMFILE errors. To fix it: sudo rm -rf meta/ (yes, sudo, see #115)

@espadrine
The Garden member

I don't get those EMFILE errors, and even if I did, I'd still need to know a reproducible way to get those errors.

I know this error happens, but I can't debug it. I made a pull request to accumulate more data to reason about
those errors.

@jankeromnes
The Garden member

I tried to run sudo node app and I got this:

child_process.js:446
    throw errnoException(errno, 'spawn');
    ^
Error: spawn EMFILE
    at errnoException (child_process.js:483:11)
    at ChildProcess.spawn (child_process.js:446:11)
    at Object.spawn (child_process.js:342:9)
    at /home/jan/pro/tree/lib/driver.js:78:11
    at Object.oncomplete (/home/jan/pro/tree/lib/driver.js:54:7)

After that, each server restart would give me:

undefined:0
^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at /home/jan/pro/tree/lib/driver.js:64:26
    at [object Object].<anonymous> (fs.js:123:5)
    at [object Object].emit (events.js:64:17)
    at Object.oncomplete (fs.js:1188:12)

And doing sudo rm -rf meta (twice) solved the issue again.

@davidaparicio
The Garden member

I do sudo rm -rf meta (twice)

Now, I do this error:

 info: socket.io started
 CA file not found: https.ca
 info: socket.io started
 opening file /
 closing file /
 Error while getting the metadata of /gateway.html

 stream.js:105
      throw er; // Unhandled stream error in pipe.
            ^
      Error: EISDIR, illegal operation on a directory
@espadrine
The Garden member
@davidaparicio
The Garden member

Or are you saying that, without doing anything, the server crashes
instantly on startup?

The server crashes instantly on startup...

@espadrine
The Garden member
@espadrine
The Garden member

It looks like we need more info from @davidaparicio, or else I'll close this issue as fixed.

@jankeromnes
The Garden member

I don't think it's fixed. Yesterday I was admiring our 4 days uptime, and then I added a file server side, and the server crashed once with the same error @davidaparicio described (without the CA line).

Sometimes our system thinks it's reading a JSON file but there is a problem making it think it's empty. Empty makes the server crashes. We should make it more robust (i.e. if metadata is empty and JSON throws Unexpected end of input we just consider metadata as being {} instead of crashing).

@jankeromnes
The Garden member

Let's assume this is fixed now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment