Multithreaded MolStandardize *InPlace functions hang with numThreads=0 and race with negative numThreads
Los mantenedores suelen responder en 3 días
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
- Área
- backend, performance
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
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
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una 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 rdkit/rdkit
-
8-membered-ring atrop stereo lost in 2026.09.1Posiblemente ocupada @pechersky la tomó hace 3 días. Abiertobug
Dificultad 2/5 Medio día Aptitud para principiantes 86/100
Los mantenedores suelen responder en 3 días
-
Make Catch2 optional when `RDK_BUILD_CPP_TESTS=OFF`Posiblemente ocupada @pechersky la tomó hace 5 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 3 días
-
CMAKE_COMPILER_IS_CLANG is determined using the compiler executable name which is incorrectPosiblemente ocupada @barlowa124 la tomó hace 5 días. Abiertobug infrastructure
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
rdkit/rdkit#9662 · 5 comentarios ·
Los mantenedores suelen responder en 3 días
-
Clarify mol_from_smiles vs qmol_from_smarts for substruct_count queries in Postgresql cartridgeAbiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 3 días
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
Los mantenedores suelen responder en 3 días
Todos los issues de rdkit/rdkit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cameri/nostream#811 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug p3 triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
bug javascript P2-medium python release:v3.1
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
adrirubio/claude-deck#546 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día