reduce在hadoop管道1.1.2上卡住(java.io.ioexception:错误的命令代码:48)

rwqw0loc  于 2021-06-03  发布在  Hadoop
关注(0)|答案(0)|浏览(258)

大家早上好,
我正在开发一个运行hadoop pipes 1.1.2的完整集群,在很长的作业中发现了以下错误:

2013-07-24 06:13:55,058 ERROR org.apache.hadoop.mapred.pipes.BinaryProtocol: java.io.IOException: Bad command code: 48
    at org.apache.hadoop.mapred.pipes.BinaryProtocol$UplinkReaderThread.run(BinaryProtocol.java:157)

(这是一个节点中的一个)

2013-07-24 06:18:03,472 ERROR org.apache.hadoop.mapred.pipes.BinaryProtocol: java.lang.NegativeArraySizeException
    at org.apache.hadoop.mapred.pipes.BinaryProtocol$UplinkReaderThread.readObject(BinaryProtocol.java:180)
    at org.apache.hadoop.mapred.pipes.BinaryProtocol$UplinkReaderThread.run(BinaryProtocol.java:132)

(其余执行reduce任务的一个)
这是我的代码。我在那里用Map按字符串里面的一个次键排序,任何性能改进也欢迎!

void ACEReducer::reduce(HadoopPipes::ReduceContext& context) {
    string fragmento, instante, contenido;
    size_t pos;

    string fichero = string();
    map<string, string> resultados;

    // Ordena la lista de valores para escribirlos conforme al instante simulado (map se encarga de la ordenacon)
    int nValores = 0;
    while (context.nextValue()) {
        fragmento = context.getInputValue();
        pos = fragmento.find("\t", 0);

        if (pos == string::npos) {
            cerr << "ERROR - Valor erroneo en Reduce." << endl;
        } else {
            instante = fragmento.substr(0, pos);
            contenido = fragmento.substr(pos+1, string::npos);

            resultados.insert(pair<string&, string&>(instante, contenido));
        }

        nValores++;
        if (nValores % 10 == 0) {
            context.progress();
        }
    }

    // Concatena los resultados ordenados y los emite para escritura.
    nValores = 0;
    for (map<string, string>::iterator it=resultados.begin(); it!=resultados.end(); it++){
        nValores++;
        if (nValores % 10 == 0) {
            context.progress();
        }
        fichero += it->second;
    }
    context.emit(context.getInputKey(), fichero);
}

抛出ioexception的代码在java binaryprotocol的run()函数中;可以在120行找到。negativearraysizeexception抛出在第133行和第149行之间的某处;我猜是这样的 int numBytes = WritableUtils.readVInt(inStream); 比int\u max高,但我不知道怎么修。
hdfs在所有节点中看起来都很健康,只有~3%的节点使用了hdfs。我使用的是非常健壮的节点,至少有64gb的ram。
我已经搜索了这个问题,但没有找到任何提示,因此非常感谢您的帮助。
提前谢谢,
río

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题