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

Multithreaded MolStandardize *InPlace functions hang with numThreads=0 and race with negative numThreads

Abierto Apto para principiantes
#9,695 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

@Ardx19 ya está trabajando en esto.

Desde el 9/10/2026.

  • #9696 de @Ardx19 — abierto

Evaluación

Dificultad
1/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
85/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
cpp, python

Línea de trabajo

El error está en standardizeMultipleMolsInPlace() en Code/GraphMol/MolStandardize/MolStandardize.cpp, donde el bucle de trabajo avanza usando el argumento sin procesar numThreads en lugar de numThreadsToUse, que es el valor resuelto. Lee cómo se llama a getNumThreadsToUse allí y luego cambia el paso del bucle al número resuelto. Está terminado cuando CleanupInPlace(mols, 0) retorna y cada molécula se procesa exactamente una vez, lo que debería comprobar una prueba de regresión en las pruebas de MolStandardize.

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

Descripción

bug

Describe the bug
The multi-molecule versions of the MolStandardize *InPlace() functions (CleanupInPlace, NormalizeInPlace, TautomerParentInPlace, ...) hang forever when called with numThreads=0 (which elsewhere in the RDKit means "use all available threads"). With negative values (e.g. -1, "all but one") several threads end up processing the same molecules concurrently while most molecules are never processed.

The cause is in standardizeMultipleMolsInPlace() in Code/GraphMol/MolStandardize/MolStandardize.cpp: the number of threads is resolved with getNumThreadsToUse(numThreads), but each worker advances by the raw argument:

for (auto mi = tidx; mi < mols.size(); mi += numThreads) {

With numThreads == 0 the stride is 0; with negative values the unsigned arithmetic wraps around.

To Reproduce

from rdkit import Chem
from rdkit.Chem.MolStandardize import rdMolStandardize

mols = [Chem.MolFromSmiles(smi) for smi in ('CCO', 'c1ccccc1', 'CC(=O)[O-].[Na+]', 'C[N+](=O)[O-]')]
rdMolStandardize.CleanupInPlace(mols, 0)   # never returns (on a machine with >1 hardware thread)

Expected behavior
numThreads=0 should use all available threads and negative values all-but-N, as with other RDKit functions taking numThreads, and each molecule should be processed exactly once.

Configuration (please complete the following information):

  • RDKit version: current master (fece8caa8, 2026.09.1)
  • OS: Ubuntu 22.04 (WSL2)
  • Python version (if relevant): 3.10
  • Are you using conda? Yes, for the build environment
  • If you are not using conda: how did you install the RDKit? Built from source

Additional context
The fix is a one-word change (stride by the resolved thread count, numThreadsToUse); I'm happy to submit a PR with a regression test.

Lenguaje dominante
HTML
Estrellas
3.6k
Forks
1.1k
Merge medio
4 d 7 h
PR fusionados (30 d)
24

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 rdkit/rdkit

Todos los issues de rdkit/rdkit

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.