【问题标题】:Raspberry Pi running Meteor bundle throws call stack exception运行 Meteor 包的 Raspberry Pi 引发调用堆栈异常
【发布时间】:2016-06-22 08:44:23
【问题描述】:

我已在 Raspberry Pi 上安装了 Node.js,并尝试在其上运行 Meteor.js 排行榜示例。我已将其捆绑并复制到 Pi。我已经设置了我的 MONGO_URL 和 npm 安装的 Fiber(经过一些麻烦)。当我尝试运行时:

$ node main.js

我得到一个Maximum call stack size exceeded 异常。

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

我用--trace 运行命令并得到了这个:

  /home/pi/bundle/server/server.js:143
  1: GetLineNumber+56(this=0x4e92928d <JS Object>, 0x26693f79 <JSMessageObject>) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 0x4e9080a1 <true>) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 <Script>>) {
  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 <Very long string[4703]>, 4641) {
  3:   } -> 0x37324625 <String[1]: ;>
  3:   SUB+48(this=4636, 4631) {
  3:   } -> 5
  3:   ADD+52(this=142, 0) {
  3:   } -> 142
  3:   new SourceLocation+40(this=0x26694b99 <a SourceLocation>, 0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 <undefined>
  2:  } -> 0x26694b99 <a SourceLocation>
  2:  ADD+52(this=142, 1) {
  2:  } -> 143
  1: } -> 143
  /home/pi/bundle/server/server.js:143
  1: GetSourceLine+56(this=0x4e92928d <JS Object>, 0x26693f79 <JSMessageObject>) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 0x4e9080a1 <true>) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 <Script>>) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd <Very long string[4703]>, 4641) {
  3:   } -> 0x37324625 <String[1]: ;>
  3:   new SourceLocation+40(this=0x26694ce5 <a SourceLocation>, 0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 <undefined>
  2:  } -> 0x26694ce5 <a SourceLocation>
  2:  SourceLocationRestrict+60(this=0x26694ce5 <a SourceLocation>, 0x4e908091 <undefined>, 0x4e908091 <undefined>) {
  3:   SUB+48(this=78, 10) {
  3:   } -> 68
  3:   SUB+48(this=4642, 4631) {
  3:   } -> 11
  2:  } -> 0x4e908091 <undefined>
  2:  SourceLocationSourceText+40(this=0x26694ce5 <a SourceLocation>) {
  3:   substring+64(this=0x3735a0cd <Very long string[4703]>, 4631, 4642) {
  3:   } -> 0x26694d29 <String[11]:   }).run();>
  2:  } -> 0x26694d29 <String[11]:   }).run();>
  1: } -> 0x26694d29 <String[11]:   }).run();>
 }).run();
  1: GetPositionInLine+56(this=0x4e92928d <JS Object>, 0x26693f79 <JSMessageObject>) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 0x4e9080b1 <false>) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 <Script>>) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd <Very long string[4703]>, 4641) {
  3:   } -> 0x37324625 <String[1]: ;>
  3:   new SourceLocation+40(this=0x26694d71 <a SourceLocation>, 0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 <undefined>
  2:  } -> 0x26694d71 <a SourceLocation>
  2:  SourceLocationRestrict+60(this=0x26694d71 <a SourceLocation>, 0x4e908091 <undefined>, 0x4e908091 <undefined>) {
  2:  } -> 0x4e908091 <undefined>
  2:  SUB+48(this=4636, 4631) {
  2:  } -> 5
  1: } -> 5
  1: GetPositionInLine+56(this=0x4e92928d <JS Object>, 0x26693f79 <JSMessageObject>) {
  2:  ScriptLocationFromPosition+64(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 0x4e9080b1 <false>) {
  3:   ScriptLineFromPosition+60(this=0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636) {
  4:    ScriptLineCount+40(this=0x26693f25 <a Script value = 0x4e953839 <Script>>) {
  4:    } -> 151
  3:   } -> 142
  3:   charAt+48(this=0x3735a0cd <Very long string[4703]>, 4641) {
  3:   } -> 0x37324625 <String[1]: ;>
  3:   new SourceLocation+40(this=0x26694e7d <a SourceLocation>, 0x26693f25 <a Script value = 0x4e953839 <Script>>, 4636, 142, 5, 4631, 4642) {
  3:   } -> 0x4e908091 <undefined>
  2:  } -> 0x26694e7d <a SourceLocation>
  2:  SourceLocationRestrict+60(this=0x26694e7d <a SourceLocation>, 0x4e908091 <undefined>, 0x4e908091 <undefined>) {
  2:  } -> 0x4e908091 <undefined>
  1: } -> 5
  ^
  1: ToString+40(this=0x4e92928d <JS Object>, 0x4e908091 <undefined>) {
  1: } -> 0x373080bd <String[9]: undefined>
  1: getter+40(this=0x26693e85 <a RangeError>) {
  2:  +40(this=0x4e908091 <undefined>, 0x4e96824d <a RangeError>) {
  3:   FormatMessage+72(this=0x4e908091 <undefined>, 0x26694ed5 <JSMessageObject>) {
  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 <undefined>, 0x2669611d <JS array[1]>, 0x26694ed5 <JSMessageObject>) {
  5:     ADD+52(this=0x373082e5 <String[0]: >, 0x59c1f9cd <String[32]: Maximum call stack size exceeded>) {
  5:     } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  5:     ADD+52(this=1, 0) {
  5:     } -> 1
  4:    } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  3:   } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  2:  } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  1: } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  RangeError:    1: getter+40(this=0x26693e85 <a RangeError>) {
  1: } -> 0x59c1f9cd <String[32]: Maximum call stack size exceeded>
  Maximum call stack size exceeded

我可以跟踪此问题的最后一个位置是在文件中:

app/packages/mongo-livedata/mongo_driver.js

大约在第 10 行:

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

我安装了最新的 npm (1.1.50) 并在全球范围内安装了 mongodb。我指的是 mongolab.com 上托管的 mongodb。我创建了一个简单的测试来连接和插入一些记录。它使用与我尝试用于 Meteor 的完全相同的 url,并且按预期工作:

var connect = require('mongodb').connect;
var url = 'mongodb://<user>:<password>@<cloud_id>.mongolab.com:<port>/<database>';
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});
        }
    });
});

我不太了解跟踪消息,但似乎 FormatString 调用是触发异常的原因。有什么建议吗?

更新:

我对此进行了更多调试,并将问题与加载此处显示为filename 的特定 mongodb 模块隔离开来。单步执行一段时间后,模块似乎在递归地包含自身。

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

【问题讨论】:

  • @Wilfred,你是对的,我目前指向托管的 mongodb。我更新了我的问题以澄清这一点。

标签: node.js mongodb meteor raspberry-pi mlab


【解决方案1】:

很遗憾,我认为 MongoDB 目前不支持 ARM 架构,请参阅https://jira.mongodb.org/browse/SERVER-1811

但是,您可以在另一台机器上运行 Mongo 并将驱动程序连接到该机器,或者如果您真的希望它在您的树莓派上运行,您可以尝试 unofficial build

【讨论】:

    【解决方案2】:

    确实,正如 Wilfred Knievel 所指出的,MongoDB 目前不支持 ARM 架构。我已经提供了 MongoDB 的(非官方)二进制文件,因此您无需重新编译它们(因为这是一个相当长/棘手的过程)。这些二进制文件,连同一个示例程序(C 语言)are available here

    【讨论】:

      【解决方案3】:

      不确定你现在是否在我们的流星万能叉

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

      但我们在那里讨论了许多问题。还有一些关于fibers和mongo的错误。请查看(已关闭)问题并查看 bintray 上的预构建二进制文件,网址为

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

      您也可以使用 node 和 mongo tgz 来启动服务。

      希望有所帮助 汤姆

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-11-28
        • 2012-05-17
        • 1970-01-01
        • 2018-08-05
        • 2010-09-12
        • 2011-02-06
        • 1970-01-01
        相关资源
        最近更新 更多