我正在我的本地计算机上进行开发,并且每隔一段时间浏览器客户端就会失去连接,如果没有我手动重启浏览器和服务器,则无法重新连接。我没有在服务器日志中看到任何错误。
OSX 10.8.4,Meteor 0.6.4.1。谷歌浏览器28.0.1500.95
关于为什么会发生这种情况的任何想法?
Meteor.status()
Object {status: "waiting", connected: false, retryCount: 2, retryTime: 1376450876245.0037}
...
Meteor.reconnect()
undefined
Meteor.status()
Object {status: "waiting", connected: false, retryCount: 11, retryTime: 1376500323062.412}
的mongod
Thu Aug 15 12:14:59.899 [initandlisten] MongoDB starting : pid=78417 port=27017 dbpath=/data/db/ 64-bit host=Kyles-MacBook.local
Thu Aug 15 12:14:59.900 [initandlisten]
Thu Aug 15 12:14:59.900 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
Thu Aug 15 12:14:59.900 [initandlisten] db version v2.4.2
Thu Aug 15 12:14:59.901 [initandlisten] git version: nogitversion
Thu Aug 15 12:14:59.901 [initandlisten] build info: Darwin Kyles-MacBook.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
Thu Aug 15 12:14:59.901 [initandlisten] allocator: tcmalloc
Thu Aug 15 12:14:59.901 [initandlisten] options: {}
Thu Aug 15 12:14:59.901 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Thu Aug 15 12:14:59.902 dbexit:
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: going to close listening sockets...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: going to flush diaglog...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: going to close sockets...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: waiting for fs preallocator...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: lock for final commit...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: final commit...
Thu Aug 15 12:14:59.902 [initandlisten] shutdown: closing all files...
Thu Aug 15 12:14:59.903 [initandlisten] closeAllFiles() finished
Thu Aug 15 12:14:59.903 [initandlisten] shutdown: removing fs lock...
Thu Aug 15 12:14:59.903 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Thu Aug 15 12:14:59.903 dbexit: really exiting now
enter code here
答案 0 :(得分:0)
Meteor使用数据线上原理。因此它可以加载到浏览器中并需要连接到互联网以维持数据的“活跃性”。
因此,当您失去连接时,其内置智能尝试重新连接。所以一开始它会尝试重新连接是小间隔。
你看到的是meteor正在重试连接到服务器
status
等待重试。 connected
是false
retryCount
显示了尝试重新连接的次数retryTime
显示最后一次或下次尝试连接时(不确定它是哪个)此时没有任何错误,但是meteor将建立你所做的任何事情(对集合的更改等),然后一旦连接它就会将这些错误提交给服务器。
如果您不想等待下一次重新连接间隔,则可以使用Meteor.reconnect()
连接到服务器,而不是刷新浏览器。这样,您也不会丢失任何未提交给服务器的数据。
如果您确定在两者之间存在良好的连接,则需要查看服务器的控制台。可能是某些东西使它崩溃/锁定主线程。也许你正在做一个阻塞密集型任务? (即从大型集合,CPU密集型任务?)
答案 1 :(得分:0)
事实证明我错误地设置了我的路线。使用Meteor-router,我根据过时的教程配置了routes.js文件。我根据流星路由器文档重新编写了路由,这清理了一切。