Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Make zombie loggers logic more robust

Ouverte
#848 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 5 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
À clarifier
Activité
À l'abandon
Stack technique
cpp, ios

Piste de recherche

Commencez par Logger::RecordShutdown dans lib/api/Logger.cpp vers la ligne 948 et suivez la protection du logger zombie utilisée pendant FlushAndTeardown. Examinez les chemins LogManager Initialize/FlushTeardown et GetLogger, puis envisagez le test de charge proposé avec une journalisation concurrente sur 100 000 itérations. C'est terminé lorsque la condition de concurrence ne provoque plus de deadlock ni de blocage de l'arrêt, sans introduire de crash.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug iOS v4

Describe your environment.

This issue is reproducible in one popular app on older models of iOS devices with slower processor.

Steps to reproduce.

Steps:

  • application exiting.
  • main thread is calling FlushAndTeardown.
  • at about the same time another thread is scheduled to perform logging on ILogger.
  • both clash with a deadlock in zombie logger protection code in Logger::RecordShutdown() method.

What is the expected behavior?

Well, it is expected that applications do not abuse the logging API that way.. At the same time we have some protection mechanism in place, to allow the safe use-after-free. Just that protection mechanism is failing at extremely low rate, unique to the concurrent-use-during-free.

What did you expect to see?

I expect:

  • the app should avoid doing what it is doing.
  • the zombie logger logic MAY be improved to handle this race condition / deadlock in zombie-logger protection code in a better way.

What is the actual behavior?

Deadlock and hang on app termination, hang in the fool-proof code that is supposed to prevent a crash due to use-after-free. As of note, the code very reliably preventing the crash ... by hanging instead. Unfortunately that hang is eventually reported as a crash.

Additional context.

The crash rate right now is extremely low. It does not seem to affect newer devices.

I think we need to add the following stress test:

  • Initialize / FlushTeardown in a tight loop on LogManager instance.
  • rogue thread(s) attempting to obtain loggers via GetLogger and log massive volumes of data
    Basic expectation here that the app should not crash after a 100,000 iterations like this. I am not sure if we can use some other fuzzy testing tools to artificially cause the deadlock.

Solution could be to perform timed-wait on mutex here:
https://github.com/microsoft/cpp_client_telemetry/blob/a924650883ecfd44f12dba131ca117f502f372b9/lib/api/Logger.cpp#L948

And when we see that the timeout happened, we return status back, and we avoid doing anything on that ILogger instance - discarding events that are timing out on that path.

Langage dominant
C
Étoiles
102
Forks
67
Merge moyen
5 j 5 h
PR mergées (30 j)
8

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/cpp_client_telemetry

Toutes les issues de microsoft/cpp_client_telemetry

Issues similaires

Plus d'issues C

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.