Raspberry Pi running Meteor bundle throws call stack exception

综合技术 2018-06-23 阅读原文

I've installed Node.js
on a Raspberry Pi and I'm attempting to run the Meteor.js leaderboard example on it. I've bundled it and copied it to the Pi. I've set my MONGO_URL and npm installed Fiber (after some trouble). When I try to run:

$ node main.js

I get a Maximum call stack size exceeded
exception.

/home/pi/bundle/server/server.js:143
  }).run();
  ^
  RangeError: Maximum call stack size exceeded

I ran the command with --trace
and got this:

/home/pi/bundle/server/server.js:143
  1: GetLineNumber+56(this=0x4e92928d , 0x26693f79 ) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 >, 4636, 0x4e9080a1 ) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 >, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 >) {
  4:    } -> 151
  4:    SUB+48(this=151, 1) {
  4:    } -> 150
  4:    ADD+52(this=0, 150) {
  4:    } -> 150
  4:    SAR+48(this=150, 1) {
  4:    } -> 75
  4:    ADD+52(this=75, 1) {
  4:    } -> 76
  4:    SUB+48(this=146, 1) {
  4:    } -> 145
  4:    SUB+48(this=146, 1) {
  4:    } -> 145
  3:   } -> 142
  3:   SUB+48(this=142, 1) {
  3:   } -> 141
  3:   ADD+52(this=4630, 1) {
  3:   } -> 4631
  3:   SUB+48(this=4642, 1) {
  3:   } -> 4641
  3:   charAt+48(this=0x3735a0cd , 4641) {
  3:   } -> 0x37324625 
  3:   SUB+48(this=4636, 4631) {
  3:   } -> 5
  3:   ADD+52(this=142, 0) {
  3:   } -> 142
  3:   new SourceLocation+40(this=0x26694b99 , 0x26693f25 <a Script value = 0x4e953839 >, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 
  2:  } -> 0x26694b99 
  2:  ADD+52(this=142, 1) {
  2:  } -> 143
  1: } -> 143
  /home/pi/bundle/server/server.js:143
  1: GetSourceLine+56(this=0x4e92928d , 0x26693f79 ) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 >, 4636, 0x4e9080a1 ) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 >, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 >) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd , 4641) {
  3:   } -> 0x37324625 
  3:   new SourceLocation+40(this=0x26694ce5 , 0x26693f25 <a Script value = 0x4e953839 >, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 
  2:  } -> 0x26694ce5 
  2:  SourceLocationRestrict+60(this=0x26694ce5 , 0x4e908091 , 0x4e908091 ) {
  3:   SUB+48(this=78, 10) {
  3:   } -> 68
  3:   SUB+48(this=4642, 4631) {
  3:   } -> 11
  2:  } -> 0x4e908091 
  2:  SourceLocationSourceText+40(this=0x26694ce5 ) {
  3:   substring+64(this=0x3735a0cd , 4631, 4642) {
  3:   } -> 0x26694d29 
  2:  } -> 0x26694d29 
  1: } -> 0x26694d29 
 }).run();
  1: GetPositionInLine+56(this=0x4e92928d , 0x26693f79 ) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 >, 4636, 0x4e9080b1 ) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 >, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 >) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd , 4641) {
  3:   } -> 0x37324625 
  3:   new SourceLocation+40(this=0x26694d71 , 0x26693f25 <a Script value = 0x4e953839 >, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 
  2:  } -> 0x26694d71 
  2:  SourceLocationRestrict+60(this=0x26694d71 , 0x4e908091 , 0x4e908091 ) {
  2:  } -> 0x4e908091 
  2:  SUB+48(this=4636, 4631) {
  2:  } -> 5
  1: } -> 5
  1: GetPositionInLine+56(this=0x4e92928d , 0x26693f79 ) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 >, 4636, 0x4e9080b1 ) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 >, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 >) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd , 4641) {
  3:   } -> 0x37324625 
  3:   new SourceLocation+40(this=0x26694e7d , 0x26693f25 <a Script value = 0x4e953839 >, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 
  2:  } -> 0x26694e7d 
  2:  SourceLocationRestrict+60(this=0x26694e7d , 0x4e908091 , 0x4e908091 ) {
  2:  } -> 0x4e908091 
  1: } -> 5
  ^
  1: ToString+40(this=0x4e92928d , 0x4e908091 ) {
  1: } -> 0x373080bd 
  1: getter+40(this=0x26693e85 ) {
  2:  +40(this=0x4e908091 , 0x4e96824d ) {
  3:   FormatMessage+72(this=0x4e908091 , 0x26694ed5 ) {
  4:    ADD+52(this=0, 1) {
  4:    } -> 1
  4:    ADD+52(this=1, 0) {
  4:    } -> 1
  4:    ADD+52(this=0, 2) {
  4:    } -> 2
  4:    FormatString+64(this=0x4e908091 , 0x2669611d , 0x26694ed5 ) {
  5:     ADD+52(this=0x373082e5 , 0x59c1f9cd ) {
  5:     } -> 0x59c1f9cd 
  5:     ADD+52(this=1, 0) {
  5:     } -> 1
  4:    } -> 0x59c1f9cd 
  3:   } -> 0x59c1f9cd 
  2:  } -> 0x59c1f9cd 
  1: } -> 0x59c1f9cd 
  RangeError:    1: getter+40(this=0x26693e85 ) {
  1: } -> 0x59c1f9cd 
  Maximum call stack size exceeded

The last place I can track this problem to is in the file:

app/packages/mongo-livedata/mongo_driver.js

at around line 10:

var MongoDB = __meteor_bootstrap__.require('mongodb');

I have the latest npm installed (1.1.50) and have npm installed mongodb globally. I am pointing to a hosted mongodb at mongolab.com. I've created a simple test to connect and insert a few records. It uses the exact same url that I'm trying to use for Meteor and it works as expected:

var connect = require('mongodb').connect;
var url = 'mongodb://:@.mongolab.com:/';
connect(url, function(err, db) {
    db.collection('test', function(err, collection) {
       // Insert 3 records
        for(var i = 0; i < 3; i++) {
          collection.insert({'a':i});
        }
    });
});

I don't really understand the trace message but it seems like FormatString
call is what triggers the exception. Any suggestions?

Update:

I've debugged this a little more and isolated the problem to the loading of a specific mongodb module shown here as filename
. From stepping through it for a while, it seems like the module is recursively including itself.

break in module.js:311
Watchers:
  0: path = ...
  1: parent = ...
  2: filename = "/home/pi/bundle/server/node_modules/mongodb/lib/mongodb/connection/repl_set.js"

 308   var hadException = true;
 309 
 310   try {
 311     module.load(filename);
 312     hadException = false;
 313   } finally {
 314     if (hadException) {
 315       delete Module._cache[filename];
 316     }
 317   }
debug> 
< RangeError: Maximum call stack size exceeded
program terminated

Problem courtesy of: code0100fun

Solution

Unfortunately I don't think that MongoDB currently supports the ARM architecture see https://jira.mongodb.org/browse/SERVER-1811

However you could run Mongo on another machine and have the drivers connect to that or if you really wanted it to run on your raspberry PI you could try an unofficial build

Solution courtesy of: Wilfred Knievel

Discussion

Indeed, as pointed out by Wilfred Knievel, MongoDB currently does not support the ARM architecture. I have made available the (unofficial) binaries of MongoDB so that you do not need to recompile them (as it is quite a long/tricky procedure). These binaries, together with a sample program (in C) are available here

Discussion courtesy of: bmorin

not sure if you now our meteor universal fork at

https://github.com/4commerce-technologies-AG/meteor

but we covered a number of issues there. Also some errors about fibers and mongo. Please take a look at the (closed) issues and check out the pre-built binaries on bintray at

https://bintray.com/4commerce-technologies-ag/meteor-universal/arm-dev-bundles/1.3.3.1/view#files/arm_dev_bundles

You may also use the node and the mongo tgz just to bring up the services.

Hope that helps
Tom

Discussion courtesy of: Tom Freudenberg

This recipe can be found in it's original form on Stack Over Flow
.

Node.js Recipes

责编内容by:Node.js Recipes阅读原文】。感谢您的支持!

您可能感兴趣的

Get a brand new Raspberry Pi 3B with 10 hours of h... A few days ago, the AAPicks team found a great deal on a Raspberry Pi bundle , which we sent your way. The only downside was that it was just ...
用树莓派和DS18B20做个汽车温度记录仪 用树莓派和DS18B20做个汽车温度记录仪 很想知道夏日阳光暴晒下,汽车内的最高温度以及温度的变化情况。觉得用树莓派和DS18B20来实现应该很简单,于是就尝试捣鼓了一下,半天时间就搞定了,写下来和大家分享。以下原创内容欢迎网友转载,但请注明出处: http://blog.163.com/he...
Getting started with the Intel Movidius Neural Com... Let me ask you three questions: What if you could could run state-of-the-art neural networks on a USB stick? What if you could see ov...
Fast in-memory search with Meteor AtQualia, we use Meteor to make awesome workflow software for title agents (amongother things!) Our users manage a lot of real ...
Playing with Raspberry Pi, Arduino, NodeMcu and MQ... These days I’m playing with IoT. Today I want to use MQTT protocol to comunicate between different devices. First I’ve start a mqtt broker in my L...