解決Appium報錯CALL_AND_RETRY_LAST Allocation failed - process out of memory


報錯信息如下:

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

Security context: 000001F25EA37349 <JS Object>
    1: /* anonymous */ [C:\Program Files (x86)\Appium\node_modules\appium\node_m
odules\appium-adb\lib\logcat.js:90] [pc=0000020C9E3A4AE9] (this=00000006B49295D9
 <JS Object>,log=000001F25EAAFB19 <String[38]: I/Recovery.JniCrash(23748): JNI_O
nLoad>)
    2: arguments adaptor frame: 3->1
    6: /* anonymous */(aka /* anonymous */) [native v8natives.js:1210] [pc=00000
20C9C76E35F] (this=000001F25EA...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

問題原因:appium取android日志,內存沒有釋放,一直在增漲。

解決辦法:本地appium安裝目錄找到logcat.js文件,例如路徑在C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\logcat.js

打開文件,注釋掉如下2行內容:

Logcat.prototype.onOutput = function (data, prefix) {
  if (!this.logcatStarted) {
    this.logcatStarted = true;
    if (!this.calledBack) {
      this.calledBack = true;
      this.onLogcatStart();
    }
  }
  data = data.trim();
  data = data.replace(/\r\n/g, "\n");
  var logs = data.split("\n");
  _.each(logs, function (log) {
    log = log.trim();
    if (log) {
      var logObj = {
        timestamp: Date.now()
      , level: 'ALL'
      , message: log
      };
      //this.logs.push(logObj);
      //this.logsSinceLastRequest.push(logObj);
      this.emit('log', logObj);
      var isTrace = /W\/Trace/.test(data);
      if (this.debug && (!isTrace || this.debugTrace)) {
        logger.debug('[LOGCAT' + prefix + '] ' + log);
      }
    }
  }.bind(this));
};

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM