huan / node-facenet

Solve face verification, recognition and clustering problems: A TensorFlow backed FaceNet implementation for Node.js.
https://zixia.github.io/node-facenet/
Apache License 2.0
406 stars 77 forks source link

ERR_IPC_CHANNEL_CLOSED on calling .align() function #82

Closed serge1peshcoff closed 6 years ago

serge1peshcoff commented 6 years ago

Provide Your Network Information

  1. Where is the location of your server? - France
  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using? - OVH

Expected behavior

Calling facenet.align() should return successful response for the valid image

Actual behavior

Sometimes I get this (I suppose it's because the python3 process crashed:

0|facedete | 2017-11-17T07:50:33.083Z - error: Error getting info Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
0|facedete |     at ChildProcess.target.send (internal/child_process.js:588:16)
0|facedete |     at Promise (/srv/facedetect/node_modules/python-bridge/index.js:36:20)
0|facedete |     at Promise._execute (/srv/facedetect/node_modules/bluebird/js/release/debuggability.js:303:9)
0|facedete |     at Promise._resolveFromExecutor (/srv/facedetect/node_modules/bluebird/js/release/promise.js:483:18)
0|facedete |     at new Promise (/srv/facedetect/node_modules/bluebird/js/release/promise.js:79:10)
0|facedete |     at enqueue (/srv/facedetect/node_modules/python-bridge/index.js:35:34)
0|facedete |     at tryCatcher (/srv/facedetect/node_modules/bluebird/js/release/util.js:16:23)
0|facedete |     at Function.Promise.attempt.Promise.try (/srv/facedetect/node_modules/bluebird/js/release/method.js:39:29)
0|facedete |     at wait.finally (/srv/facedetect/node_modules/python-bridge/index.js:148:28)
0|facedete |     at PassThroughHandlerContext.finallyHandler (/srv/facedetect/node_modules/bluebird/js/release/finally.js:56:23)
0|facedete |     at PassThroughHandlerContext.tryCatcher (/srv/facedetect/node_modules/bluebird/js/release/util.js:16:23)
0|facedete |     at Promise._settlePromiseFromHandler (/srv/facedetect/node_modules/bluebird/js/release/promise.js:512:31)
0|facedete |     at Promise._settlePromise (/srv/facedetect/node_modules/bluebird/js/release/promise.js:569:18)
0|facedete |     at Promise._settlePromiseCtx (/srv/facedetect/node_modules/bluebird/js/release/promise.js:606:10)
0|facedete |     at Async._drainQueue (/srv/facedetect/node_modules/bluebird/js/release/async.js:138:12)
0|facedete |     at Async._drainQueues (/srv/facedetect/node_modules/bluebird/js/release/async.js:143:10)

Steps to reproduce the behavior (and fixes, if any)

Reproducing:

The fix can be restarting the python3 process on getting such an error. (No idea actually if this should belong to this repository or python-bridge?)

Full Output Logs

See above

huan commented 6 years ago

How much ram do you have in your system?

The alias() use MTCNN to detect faces and it will eat lots of memory for large photos.

If you want to process a photo with the size larger than 2000x2000, You must have at least 8GB memory, or the Python might crash due to leak of memory.

serge1peshcoff commented 6 years ago

@zixia 4gb according to free -m output

# free -m
      total        used        free      shared  buff/cache   available
Mem:           4096         931        3164         968           0        3164
Swap:          2048         124        1923
huan commented 6 years ago

So I believe you will be OK after upgrading your memory to 8GB(12GB is better) with a 4GB swap(optional).

huan commented 6 years ago

@serge1peshcoff Did you solve your problem by adding more memory?

If so, please close this issue.

serge1peshcoff commented 6 years ago

I eventually just wrapped my code into try/catch statement and just restarted it if this error is occured. That works.