A
A
Archakov Dennis2016-06-27 19:23:09
Node.js
Archakov Dennis, 2016-06-27 19:23:09

FATAL ERROR: CALL_AND_RETRY_LAST - why?

var express = require('express');
var app = require('http').createServer()
var io = require('socket.io')(app);

var Twitter = require('twitter');
 
var client = new Twitter({
  consumer_key: '***',
  consumer_secret: '***',
  access_token_key: '***',
  access_token_secret: '***'
});
 
var questions = result = [];

app.listen(process.env.PORT || 3000);

io.on('connection', function (socket) {

    var params = {q:encodeURIComponent('#javascript'),result_type:'recent','count':10};
    client.get('search/tweets', params, function(error, tweets, response){
      var tweet = tweets.statuses;
      for (var i = 0; i < tweet.length; i++)
      questions.push(tweet[i].text+'|https://twitter.com/chuckdowe/status/'+tweet[i].id);
      socket.emit('tweets', JSON.stringify(questions));
    });

    setInterval(function(){
      var params = {q:encodeURIComponent('#javascript'),result_type:'recent','count':10};
      client.get('search/tweets', params, function(error, tweets, response){
        var tweet = tweets.statuses;
        var arr = [];

        for (var i = 0; i < tweet.length; i++)
          for (var z = 0; z < questions.length; z++ )
            if (questions[z].indexOf(tweet[i])<0)
            {
              arr.push(tweet[i].text+'|https://twitter.com/chuckdowe/status/'+tweet[i].id);
              questions.push(tweet[i].text+'|https://twitter.com/chuckdowe/status/'+tweet[i].id);
            }

        socket.emit('newtweets', JSON.stringify(arr));
      });
    },10000);

});

Mistake:
<--- Last few GCs --->

   20804 ms: Scavenge 1397.5 (1456.2) -> 1397.5 (1456.2) MB, 0.4 / 0 ms (+ 5.3 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
   22013 ms: Mark-sweep 1397.5 (1456.2) -> 1397.5 (1456.2) MB, 1208.6 / 0 ms (+ 37.4 ms in 253 steps since start of marking, biggest step 5.3 ms) [last resort gc].
   23181 ms: Mark-sweep 1397.5 (1456.2) -> 1397.5 (1456.2) MB, 1167.9 / 0 ms [last resort gc].


<--- JS stacktrace --->

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

Security context: 0x3a56eae37399 <JS Object>
    1: indexOf(aka indexOf) [native string.js:~76] [pc=0x3fce247d9e7e] (this=0x1ef5e34fdb11 <String[169]: JavaScriptDaily: JavaScript Performance Updates in Microsoft Edge and Chakra: https://t.co/CvltapIweb #javascript|https://twitter.com/chuckdowe/status/747463523672948700>,z=0x30710d6fcd81 <an Object with map 0x9e53aa6e589>)
    2: /* anonymous */(aka /* anonymous */) [/Applications/MAMP/htd...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Abort trap: 6

What is the problem? I noticed that this happens when I work with an array.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Wolf, 2016-06-27
@mannaro

`process out of memory` - the RAM is over.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question