MantisBT - VTK
View Issue Details
0015365VTK(No Category)public2015-03-09 13:492016-01-14 13:10
David Gobbi 
Cory Quammen 
highcrashhave not tried
closedfixed 
6.2.0 
6.2.1 
TBD
crash
0015365: Crash in vtkLookupTableMapData if called from multiple threads
This morning I saw a crash in the following recently-added vtkLookupTable code, when using the lookup table via vtkImageMapToColors on a multi-CPU workstation. By adding print statements, I saw that vtkLookupTableMapData() was being called from multiple threads, which were simultaneously calling the Resize() function. It looks like a mutex will be needed in order to make the code thread-safe.

  // Resize the internal table to hold the special colors at the
  // end. When this function is called repeatedly with the same size
  // lookup table, memory reallocation will be done only one the first
  // call if at all.
  vtkUnsignedCharArray* lookupTable = self->GetTable();
  vtkIdType numberOfColors = lookupTable->GetNumberOfTuples();
  vtkIdType neededSize = (numberOfColors + vtkLookupTable::NUMBER_OF_SPECIAL_COLORS) *
    lookupTable->GetNumberOfComponents();
  if (lookupTable->GetSize() < neededSize)
    {
    lookupTable->Resize(numberOfColors + vtkLookupTable::NUMBER_OF_SPECIAL_COLORS);
    }
No tags attached.
related to 0015903closed Cory Quammen Race condition in accessing lookup table bwLut from vtkLookupTableMapData() in the TestMedical3 example 
Issue History
2015-03-09 13:49David GobbiNew Issue
2015-03-09 13:49David GobbiAssigned To => Cory Quammen
2015-03-13 09:20Cory QuammenPrioritynormal => high
2015-03-13 09:20Cory QuammenSeverityminor => crash
2015-03-15 00:39Cory QuammenNote Added: 0034306
2015-03-15 00:39Cory QuammenStatusbacklog => active development
2015-03-16 14:32Cory QuammenStatusactive development => gerrit review
2015-03-25 11:31Cory QuammenNote Added: 0034326
2015-04-16 22:05Cory QuammenNote Added: 0034364
2015-04-16 22:05Cory QuammenStatusgerrit review => closed
2015-04-16 22:05Cory QuammenResolutionopen => fixed
2015-04-16 22:05Cory QuammenFixed in Version => 6.2.1
2016-01-14 13:10David GobbiRelationship addedrelated to 0015903

Notes
(0034306)
Cory Quammen   
2015-03-15 00:39   
Proposed bug fix posted on gerrit: http://review.source.kitware.com/#/t/5576/ [^]
(0034326)
Cory Quammen   
2015-03-25 11:31   
Same fix posted to GitLab: https://gitlab.kitware.com/vtk/vtk/merge_requests/36 [^]
(0034364)
Cory Quammen   
2015-04-16 22:05   
Commit 3461a397a49fc675a39e6a46c628cebe8cbe1fbb

Authored by Utkarsh Ayachit 21 days ago
Committed by Kitware Robot 21 days ago
2 parents b226675e dac748ae
 master ...
Merge topic '15365_thread_safety'
dac748ae BUG 15365: Fixed crash in function called from multiple threads

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: David Gobbi <david.gobbi@gmail.com>
Merge-request: !36