Default logger startup interleaves class resolution with logger creation, leaking an already-started logger when a later entry fails
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- scala
- Área
- distributed-systems
Línea de trabajo
Read actor/src/main/scala/org/apache/pekko/event/Logging.scala around lines 137-159 and 192-209 to see logger creation and teardown. Add a test in actor-tests/src/test/scala/org/apache/pekko/event/LoggerSpec.scala with one valid and one invalid logger. Done means system creation fails with ConfigurationException and the valid logger actor is stopped and unsubscribed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
startDefaultLoggers resolves and creates each configured logger inside a single for-comprehension. If entry N cannot be resolved, entries 1..N-1 have already been created as system actors, but the loggers field is only assigned after the whole comprehension succeeds — so the teardown path never sees them.
Evidence
actor/src/main/scala/org/apache/pekko/event/Logging.scala:137-159:
val myloggers =
for {
loggerName <- defaultLoggers
if loggerName != StandardOutLogger.getClass.getName
} yield {
system.dynamicAccess
.getClassFor[Actor](loggerName)
.map { actorClass =>
addLogger(system, actorClass, level, logName) // creates the actor
}
.recover {
case e =>
throw new ConfigurationException(
"Logger specified in config can't be loaded [" + loggerName +
"] due to [" + e.toString + "]", e)
}
.get // throws here
}
guard.lock()
try {
loggers = myloggers // :159 — never reached
addLogger (:216-226) creates the actor and blocks on initialization:
val actor = system.systemActorOf(Props(clazz).withDispatcher(system.settings.LoggersDispatcher), name)
implicit def timeout: Timeout = system.settings.LoggerStartTimeout
...
try Await.result(actor ? InitializeLogger(this), timeout.duration)
stopDefaultLoggers (:192-209) iterates the loggers field:
for {
logger <- loggers
if logger != StandardOutLogger
} {
// this is very necessary, else you get infinite loop with DeadLetter
unsubscribe(logger)
logger match {
case ref: InternalActorRef => ref.stop()
case _ =>
}
}
Impact
With pekko.loggers = [<valid>, <invalid>], the valid logger is created as a system actor and initialized, then the ConfigurationException propagates before loggers = myloggers executes. System creation fails, and stopDefaultLoggers iterates a loggers value that does not contain the already-started actor — so it is neither unsubscribed nor stopped. A partially-initialized logging setup outlives the failed ActorSystem creation.
Suggested direction
Resolve every class name first and fail fast before creating any actor, then create the loggers. Alternatively, accumulate successfully-created loggers so the failure path can unsubscribe and stop them.
Test
actor-tests/src/test/scala/org/apache/pekko/event/LoggerSpec.scala — a case configuring one valid plus one unresolvable logger, asserting that system creation fails with ConfigurationException and that the valid logger actor has been stopped and unsubscribed.
- Lenguaje dominante
- Scala
- Estrellas
- 1.7k
- Forks
- 212
- Merge medio
- 18 h 20 min
- PR fusionados (30 d)
- 108
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 apache/pekko
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/pekko#1840 · 8 comentarios ·
Los mantenedores suelen responder en 1 día
-
Coordinator singleton lease loss permanently stops the local ShardRegion while the node is still UpPosiblemente ocupada @He-Pin la tomó hace 4 días. Abiertobug cluster
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
enhancement flaky make-tests-easier-to-run
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
build enhancement github_actions
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/pekko
Issues similares
-
GeoSeries scale and skew tests fail with pytest 9.2.0Posiblemente ocupada @jiayuasu la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[BUG] Python unit CI fails on Ubuntu 26.04 runnerPosiblemente ocupada @parthosa la tomó hoy. Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 83/100
NVIDIA/cudf-spark-tools#2207 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
canton-network/splice#8087 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día