azurestorage和NodeJS中的getaddrinfo错误

时间:2015-09-16 16:28:16

标签: javascript node.js azure azure-storage-blobs azure-storage-queues

我正在执行将应用程序发送到Azure存储容器的应用程序,然后向Azure队列发送消息。

当我达到大约1000~1020条消息时,我无法发送更多文件和消息。我也注意到,当我尝试检查队列中有多少消息时,我有一个错误。

错误是:

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

我的代码是:

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);

        }
        });
}

发送消息的功能是:

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);
    }
});

}

我真的迷失在这里。 谢谢。

2 个答案:

答案 0 :(得分:2)

通常EADDRINFO是在无法找到IP地址的情况下查找主机名的IP地址时可能出现的错误类型。我没有看到你的代码有问题。您可以启用详细日志并分享满足该问题的请求吗?要启用详细日志,您可以致电:     


    var storage = require('azure-storage');
    blobSvcInput.logger.level = storage.Logger.LogLevels.DEBUG;
    queueSvc.logger.level = storage.Logger.LogLevels.DEBUG;
    

答案 1 :(得分:0)

我尝试了更多测试。我在我的本地机器上测试过,我没有问题。

所以现在我检查了版本,我的云vm是版本0.10和我的本地0.12。

我删除并强制安装0.12。现在工作正常。谢谢大家。

我怀疑这可能是0.12的v8引擎。