[Bug]: Beam engine: a transform error that is not thrown (setErrors/stopAll) does not fail the pipeline

Aperta Adatta ai principianti
#9,803 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
83/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Leggi plugins/engines/beam/.../core/transform/TransformFn.java, in particolare emptyRowBuffer e il controllo degli errori esistente in iterate. Confronta il modo in cui oneIteration() segnala gli errori di trasformazione, quindi esegui i test del motore Beam che coprono gli errori di trasformazione. Il lavoro è completato quando un errore registrato tramite setErrors fa fallire la pipeline Beam invece di farla terminare con successo con righe perse.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Beam P2
Apache Hop version?

2.19.0 (the same code is on main)

Java version?

21

Operating system

Linux

What happened?

On the Beam engine (Spark runner, local master; the Direct runner behaves the same), a transform that fails by recording an error instead of throwing does not fail the pipeline. The run ends as succeeded and the error only appears in the log.

Example with the REST client transform: method POST, "Retry times" 0, retry status codes 400-599. The server answers 400 on the 6th row. Rest.processRow catches the HopException ("Request failed after retries, status: 400"), calls setErrors(1) and stopAll(), and returns false (Rest.java, around line 2162). On the local engine the same pipeline fails, as expected. On the Beam engine it finishes as succeeded with 5 rows written.

Cause: in plugins/engines/beam/.../core/transform/TransformFn.java, the per-element path processElement -> emptyRowBuffer calls executor.oneIteration() and checks neither its result nor the error count:

    // Execute all transforms in the transformation
    //
    executor.oneIteration();

    outputResults(context);

SingleThreadedPipelineExecutor.oneIteration() returns false when a transform has errors, but this is ignored. The two other call sites in the same class already check it:

  private void iterate(TupleOutputContext<HopRow> output) throws HopException {
    executor.oneIteration();
    if (executor.getErrors() > 0) {
      throw new HopException("Transform '" + transformName + "' failed");
    }
    outputResults(output);
  }

Proposed fix: apply the same check in emptyRowBuffer, so that the exception reaches the catch in processElement, the TransformProcessErrors counter is incremented and the Beam job fails:

    executor.oneIteration();
    if (executor.getErrors() > 0) {
      throw new HopException("Transform '" + transformName + "' failed");
    }

    outputResults(context);

This affects every transform that follows the usual logError / setErrors(1) / stopAll() pattern without error handling, not only REST: on the Beam engine its failures are silent, and rows can be lost.

Issue Priority

Priority: 2

Issue Component

Component: Beam

Lingua principale
Java
Stelle
1.6k
Fork
499
Merge medio
1g 5h
PR unite (30g)
316

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/hop

Tutte le issue di apache/hop

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.