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

Crash creating and using OSLCompiler instances in mutliple threads

Abierto
#1,427 6 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp

Línea de trabajo

No se nombra ningún archivo ni prueba. Comienza con SymbolTable::delete_syms() y el TypeSpec::struct_list() compartido descrito en el informe, y luego rastrea su uso por parte de OSLCompiler y ShadingSystem. Se considerará completado cuando exista un diseño acordado de propiedad o sincronización para instancias concurrentes y haya evidencia de que se evita el fallo.

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

Descripción

Problem

In the Cycles renderer we are getting crashes doing different renders in different threads, each creating their own OSLCompiler instances. From #654 it appears that this is supposed to work.

I think I understand the cause and am willing to contribute a fix, but looking for advice on the best way to solve this.

What happens is that OSLCompiler ends up calling this in its destructor:

void
SymbolTable::delete_syms()
{
    for (auto& sym : m_allsyms)
        delete sym;
    m_allsyms.clear();
    TypeSpec::struct_list().clear();
}

This TypeSpec::struct_list() is a global variable used by OSLCompiler, and also ShadingSystem. So fully clearing it here is not safe.

I can think of a few solutions:

  1. Never clear this list and accept the memory usage. ShadingSystem does not clear it as far as I can tell, so you already have this when not compiling shaders.
  2. Add reference counting to only clear this list when there are zero classes using it. This also involves adding mutex protection in a bunch of places.
  3. Add a struct list per OSLCompiler and ShadingSystem, instead of making it global.

Solution (3) seems like the best to me, does that seem reasonable? Or is there some performance reason that this should be reused.

Versions
  • OSL branch/version: master branch, 6b6637e
  • OS: Ubuntu Linux
  • C++ compiler: Clang
Lenguaje dominante
C++
Estrellas
2.3k
Forks
414
Merge medio
4 d 16 h
PR fusionados (30 d)
20

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 AcademySoftwareFoundation/OpenShadingLanguage

Todos los issues de AcademySoftwareFoundation/OpenShadingLanguage

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.