Search code examples
javascriptnode.jsazureazure-blob-storageazure-storage-queues

Error getaddrinfo in azurestorage and NodeJS


I'm doing and application that send a file to Azure Storage Container and after this send a message to Azure Queue.

I cann't send more files and messages when I reach about 1000~1020 messages. I noticed too, that when I try to check how many messages are in the queue, I have an error.

The error is:

    { [Error: getaddrinfo EADDRINFO] code: 'EADDRINFO', errno: 'EADDRINFO', syscall: 'getaddrinfo' }

My code is:

function start(pos) {

var entry = inputs[pos]; // The array stars at 0 (zero)
console.log(entry); // Print current file

//Let's start the uploading
blobSvcInput.createContainerIfNotExists(containerInput, function(error, result, response){ // this function will create a container in Azure Storage (if this does not already exist)
        if(!error){
            // The Container was created or already exist
            blobSvcInput.createBlockBlobFromLocalFile(containerInput, "input"+pos, entry, function(error, result, response){ // this function will create a new Blob in Azure Storage (Uploading the entry)
                if(!error){
                    //No errors occurred - File uploaded

                    //Now we will send a message to the Azure Queue 
                    setTimeout(function(){ sendMsg(pos);  }, 0);                                            

                }else{          
                    //An error occurred when upload the file. We need to start again.                                                           
                    console.log("Error when uploading Blob.");
                    console.log(error);
                    console.log(result);
                    console.log(response);
                    setTimeout(function(){ start(pos);  }, 2500);

                }
                });
        }else{ 
            // An error occurred when was trying create a Container
            console.log("Error when creating Container.");

            console.log(error);
            console.log(result);
            console.log(response);


                // We need to try again                             
            setTimeout(function(){ start(pos);  }, 2500);

        }
        });
}

The function to send the message is:

function sendMsg (pos) {
//Here I'll format the content of my message
var msg = formatMessage(pos,1);


queueSvc.createQueueIfNotExists(queue, function(error, result, response){ // Create Queue, if it does not exist
    if(!error){ // Queue already exist or was created

    queueSvc.createMessage(queue, msg, function(error, result, response){ // Send the message

        if(!error){//Success sending the message

            totalMsgsSent++; // Just for control
            pos += parallelSend;
            if(pos <= inputs.length){
                setTimeout(function(){ start(pos);  }, 0);
            }
        }else{
            //Error occurred when sending the message
            console.log("Error occurred when sending the message")
            console.log(error);
            console.log(result);
            console.log(response);
            setTimeout(function(){ sendMsg(pos);  }, 2000);
        }
    });


    }else{
        //Occurred a error when creating the queue
        console.log("Occurred a error when creating the queue")
        console.log(error);
        console.log(result);
        console.log(response);
        setTimeout(function(){ sendMsg(pos);  }, 2000);
    }
});

}

I'm really lost here. Thank you.


Solution

  • I tried some more tests. I tested in my local machine and I hadn't the problem.

    So now I checked the version and my cloud vm was the version 0.10 and my local 0.12.

    I removed and forced a 0.12 installation. Now it is working fine. Thanks you all.

    I suspected that may be the v8 engine from 0.12.