Same-date blocking states: an unblock inserted before its block is silently dropped and billing stops permanently
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Start with BlockingStateService.addBlockingState, then trace DefaultBlockingState.compareTo and BlockingCalculator.eventsToRemove to understand how same-date states affect billing events. Add regression coverage for both insertion orders, including the case where an unmatched unblock arrives first; done means both orderings produce the same intended billing outcome and future events are not silently removed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Two blocking states with the same effective date produce opposite outcomes depending only on which was created first, and one of those outcomes removes every future billing event for the subscription with nothing to restore it.
The two orderings, same two facts, same instant:
| created first | result |
|---|---|
| block, then unblock | no blocking applied (correct: the pair matches, the zero-day duration is discarded) |
| unblock, then block | blocked from that instant with a null end date, no re-enable, forever |
The mechanism. BlockingStateService.addBlockingState is a two-branch state machine with no else:
if (currentBlockingState.isBlockBilling() && firstBlockingState == null) {
perObjectTypeFirstBlockingState.put(currentBlockingState.getBlockedId(), currentBlockingState);
} else if (!currentBlockingState.isBlockBilling() && firstBlockingState != null) {
addDisabledDuration(firstBlockingState, currentBlockingState.getEffectiveDate());
perObjectTypeFirstBlockingState.put(currentBlockingState.getBlockedId(), null);
}
An unblock arriving with no open block matches neither branch and is discarded without a log. Ordering for same-date states comes from DefaultBlockingState.compareTo: effectiveDate, then createdDate, then totalOrdering, so insertion order decides which of the two rows above you get.
The surviving block is then closed by build() with a null end, and addDisabledDuration's end == null short-circuits the one-day minimum, so the unbounded duration is always added. BlockingCalculator.eventsToRemove removes every billing event on or after the start when duration.getEnd() == null, and createNewEvents documents the rest itself: "no second event in the pair means they are still disabled (no re-enable)".
Reachability. DefaultSubscriptionApi.addBlockingState validates the service name and reserved state names only; its own comment says "This is in no way an exhaustive arg validation". Nothing requires an unblock to have a matching open block, so a caller correcting a mistake, or a plugin writing both states in one batch, can produce the second ordering through the public API.
How this was checked, stated plainly. I transcribed the pairing logic into a small script and ran both orderings against the transcription, checked line by line against the Java at 3868a5b. I did not run Kill Bill itself for this one, and no invoice was generated, so this is a code-reading finding with a transcription-level reproduction, not an end-to-end one. It is the same event-collision family as #2320 and #2321.
Suggested direction. At minimum, an else branch that logs an unmatched unblock, so a permanent silent billing stop becomes something an operator can find. The stronger fix is treating an unmatched unblock as closing at its own effective date regardless of insertion order, which makes the outcome order-independent. Happy to write the regression test against the released tag the way #2320 and #2321 were done, if that is useful.
- Lenguaje dominante
- Java
- Estrellas
- 5.9k
- Forks
- 980
- Merge medio
- 3 d 10 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de killbill/killbill
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Configure global lock retries and queue reschedule intervals for robust concurrency handlingPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Large invoice creation fails because billing_events exceeds BLOB limitPosiblemente ocupada @jutur la tomó hace 115 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Incorrect location header returned by Trigger invoice group run endpointQuizá libre de nuevo @lkxdsb la tomó hace 79 días y no hay ningún pull request abierto. Abiertobug JAXRS
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Todos los issues de killbill/killbill
Issues similares
-
status:pending type:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
A CSV row that removes a language with #CLEAR and fills another name of it keeps one of themAbiertobug level:trivial
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
exoego/keycloak-fuhito#666 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ant-media/Ant-Media-Server#8185 ·
Los mantenedores suelen responder en 4 días
-
desktop grp:about type:graphics-bug ui-public
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día