我在Windows 7,64位上安装了ArangoDB 2.7.3。
我有一个用例,其中一个Foxx应用程序A公开我想在另一个Foxx应用程序B中使用的存储库中的某些功能,这样我就不必复制该特定功能。应用程序B实际上启动了一个周期性触发的作业,该作业从A调用导出的功能。问题是,偶尔该作业会抛出一个错误,它找不到导出的模块。但是一段时间后它就会恢复。
我在Github上添加了两个应用程序:https://github.com/mphoenixo/arangodb.git
以前有没有人经历过这个?我使用ArangoDB的文档构建了应用程序,但也许我还缺少一些东西。
错误的堆栈跟踪如下:
2016-02-02T15:48:56Z [7380] ERROR TypeError: Cannot read property 'repo' of undefined
2016-02-02T15:48:56Z [7380] ERROR at d:/install/ArangoDB 2.7.3/var/lib/arangodb-apps/_db/DataPushLandingZone/foxx-import-app-example/APP/scripts/myJob.js:3:25
2016-02-02T15:48:56Z [7380] ERROR at [object Object].Module.run (D:\install\ArangoDB 2.7.3\bin\../share/arangodb/js/common/bootstrap/modules.js:1420:10)
2016-02-02T15:48:56Z [7380] ERROR at ArangoApp.loadAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/arangoApp.js:458:24)
2016-02-02T15:48:56Z [7380] ERROR at executeAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:510:18)
2016-02-02T15:48:56Z [7380] ERROR at Object.runScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:814:10)
2016-02-02T15:48:56Z [7380] ERROR at Object.exports.work (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/queues/worker.js:118:8)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:6:60)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:15)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:27)
2016-02-02T15:48:56Z [7380] ERROR
2016-02-02T15:48:56Z [7380] ERROR Running script "MyJob" not possible for mount "/foxx-import-app-example":
2016-02-02T15:48:56Z [7380] ERROR TypeError: Cannot read property 'repo' of undefined
2016-02-02T15:48:56Z [7380] ERROR at d:/install/ArangoDB 2.7.3/var/lib/arangodb-apps/_db/DataPushLandingZone/foxx-import-app-example/APP/scripts/myJob.js:3:25
2016-02-02T15:48:56Z [7380] ERROR at [object Object].Module.run (D:\install\ArangoDB 2.7.3\bin\../share/arangodb/js/common/bootstrap/modules.js:1420:10)
2016-02-02T15:48:56Z [7380] ERROR at ArangoApp.loadAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/arangoApp.js:458:24)
2016-02-02T15:48:56Z [7380] ERROR at executeAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:510:18)
2016-02-02T15:48:56Z [7380] ERROR at Object.runScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:814:10)
2016-02-02T15:48:56Z [7380] ERROR at Object.exports.work (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/queues/worker.js:118:8)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:6:60)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:15)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:27)
2016-02-02T15:48:56Z [7380] ERROR
2016-02-02T15:48:56Z [7380] ERROR Job 47455086883 failed:
2016-02-02T15:48:56Z [7380] ERROR [ArangoError 3103: failed to invoke module
2016-02-02T15:48:56Z [7380] ERROR File: d:/install/ArangoDB 2.7.3/var/lib/arangodb-apps/_db/DataPushLandingZone/foxx-import-app-example/APP/scripts/myJob.js]
2016-02-02T15:48:56Z [7380] ERROR at [object Object].Module.run (D:\install\ArangoDB 2.7.3\bin\../share/arangodb/js/common/bootstrap/modules.js:1425:20)
2016-02-02T15:48:56Z [7380] ERROR at ArangoApp.loadAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/arangoApp.js:458:24)
2016-02-02T15:48:56Z [7380] ERROR at executeAppScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:510:18)
2016-02-02T15:48:56Z [7380] ERROR at Object.runScript (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:814:10)
2016-02-02T15:48:56Z [7380] ERROR at Object.exports.work (d:/install/ArangoDB 2.7.3/share/arangodb/js/server/modules/org/arangodb/foxx/queues/worker.js:118:8)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:6:60)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:15)
2016-02-02T15:48:56Z [7380] ERROR at eval (<anonymous>:9:27)
谢谢!
答案 0 :(得分:0)
您的代码看起来很好。我不确定你遇到的根本原因可能是什么,但我相当确信,由于某种原因,你试图导入的Foxx服务在作业执行时没有初始化。
您可能偶尔遇到此问题的一个原因是ArangoDB使用多个执行JavaScript的V8上下文。作业和HTTP请求随机地在其中任何一个中执行。因此,如果其中一个出现故障,如果在另一个环境中执行该作业,该作业可能仍然可以正常运行。
通常,导入Foxx服务应该保证该服务已正确初始化(就像在该服务中运行作业或从该服务提供请求一样)。当你指出问题可能是自我修复时(即它在一段时间后停止发生),这可能意味着上下文最终被正确初始化。
我也无法在2.8上重现这个问题,但我们会密切关注这一点。我不相信这个问题是特定于Windows的。如果问题再次出现,我建议进一步讨论the Google Groups thread和opening an issue on GitHub。