Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Fragile window abandonment during concatMap operations; silent data loss

Abierto
#7,956 2 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

Comienza ejecutando las dos reproducciones usando Flowable.window() con concatMapSingle() y concatMapMaybe(), comparando las variantes de blockingSubscribe(). Rastrea la interacción entre el abandono de ventanas y la suscripción downstream; se considera terminado cuando las ventanas no se descartan silenciosamente o el abandono produce el error documentado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

3.x 4.x Investigating

Combining the Flowable.window() family of operators with any of the Flowable.concatMap*() operators appears to cause window abandonment bugs which are sensitive to how the outer Flowable is processed downstream. This despite the given concatMap lambdas returning an Rx Single/Maybe ready to be subscribed as soon as they are returned and which will signal the upstream window for subscription synchronously.

In the demonstrations below, I subscribe to identical .window().concatMap() constructions with very slightly different downstreams (.blockingSuscribe(System.out::println) vs. .doOnNext(System.out::println).blockingSubscribe()) and they emit drastically different results due to silent data-loss.

Example: Windowing a stream into lists, similar to the buffer() operator.

    public static void main(String[] args) {
        final var content = Flowable
                .rangeLong(0, 100)
                .window(10)
                .concatMapSingle(Flowable::toList);

        System.out.println("Example 1: Expected behavior for concetMapSingle(Flowable::toList)");
        content
                .doOnNext(System.out::println)
                .blockingSubscribe();

        System.out.println("Example 2: Window abandonment & data-loss");
        content
                .blockingSubscribe(System.out::println);
    }

Output:

Example 1: Expected behavior for concetMapSingle(Flowable::toList)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
[20, 21, 22, 23, 24, 25, 26, 27, 28, 29]
[30, 31, 32, 33, 34, 35, 36, 37, 38, 39]
[40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
[50, 51, 52, 53, 54, 55, 56, 57, 58, 59]
[60, 61, 62, 63, 64, 65, 66, 67, 68, 69]
[70, 71, 72, 73, 74, 75, 76, 77, 78, 79]
[80, 81, 82, 83, 84, 85, 86, 87, 88, 89]
[90, 91, 92, 93, 94, 95, 96, 97, 98, 99]

Example 2: Window abandonment & data-loss
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[10]
[20]
[30]
[40]
[50]
[60]
[70]
[80]
[90]

Example: Windowing a stream into a simple reduction operation.

    public static void main(String[] args) {
        final var windowSums = Flowable
                .rangeLong(0, 100)
                .window(10)
                .concatMapMaybe(window -> window.reduce(Long::sum));

        System.out.println("Example 3: Expected behavior for concetMapMaybe(window -> window.reduce(Long::sum))");
        windowSums
                .doOnNext(System.out::println)
                .blockingSubscribe();

        System.out.println("Example 4: Silent data loss");
        windowSums
                .blockingSubscribe(System.out::println);
    }

Output:

Example 3: Expected behavior for concetMapMaybe(window -> window.reduce(Long::sum))
45
145
245
345
445
545
645
745
845
945

Example 4: Silent data loss
45
10
20
30
40
50
60
70
80
90

The flatMap*() family of operators seem less prone to this behavior but don't guarantee to retain the upstream ordering.

Ideally, I'd expect window() to be compatible with concatMap(). But if such is impossible, I'd expect the window-abandonment detection described in https://github.com/ReactiveX/RxJava/wiki/What%27s-different-in-3.0#window-abandonment-in-window to at least signal an error.

Lenguaje dominante
Java
Estrellas
48.2k
Forks
7.6k
Merge medio
3 h 9 min
PR fusionados (30 d)
25

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ReactiveX/RxJava

Todos los issues de ReactiveX/RxJava

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.