nadav-dav / rekuire

'rekuire' is basically node's 'require' without the relative paths
93 stars 10 forks source link

require('rekuire') fails with docker #15

Closed romanlab closed 6 years ago

romanlab commented 8 years ago

requiring rekuire fails in a docker container based on ubuntu. works fine with the same code on ubuntu outside of docker

root@b4bcdedb6ca1:/src# node index.js
here

<--- Last few GCs --->

  204038 ms: Scavenge 1391.1 (1456.0) -> 1391.1 (1456.0) MB, 1.0 / 0 ms (+ 15.6 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
  205573 ms: Mark-sweep 1391.1 (1456.0) -> 1391.0 (1456.0) MB, 1534.8 / 0 ms (+ 1202.9 ms in 3538 steps since start of marking, biggest step 15.6 ms) [last resort gc].
  206554 ms: Mark-sweep 1391.0 (1456.0) -> 1391.0 (1456.0) MB, 980.4 / 0 ms [last resort gc].

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0xc83332b4629 <JS Object>
    1: insertPathToIndex(aka insertPathToIndex) [/node_modules/rekuire/lib/helpers/scanner.js:~98] [pc=0x1dc4575964e7] (this=0xc83332041b9 <undefined>,alias=0x146477907b29 <String[538]: proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/r...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Aborted
nadav-dav commented 8 years ago

Seem like the container is lacking memory, can you estimate how many files are in your project?

romanlab commented 8 years ago

there are a 121 files but look at the part: <String[538]: proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/root/proc/1/r...

I don't think more memory will help here, this looks recursive and seems to me it'll consume any amount of memory it's given. Also, the container has 2GB memory. I don't see how rekuire has a bigger memory footprint than 2GB. The app running there is a rather simple express app

romanlab commented 6 years ago

No one cares i guess...

nadav-dav commented 6 years ago

Hey Roman! Sorry for not being responsive, would you like to help me patch this lib? I would LOVE some help with a pull request <3