Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault of coclustering on debian 12 #163

Closed
bruno-at-orange opened this issue Feb 21, 2024 · 3 comments · Fixed by #238
Closed

Segmentation fault of coclustering on debian 12 #163

bruno-at-orange opened this issue Feb 21, 2024 · 3 comments · Fixed by #238
Assignees
Labels
Priority/0 To do NOW Type/Bug Something isn't working

Comments

@bruno-at-orange
Copy link
Contributor

bruno-at-orange commented Feb 21, 2024

Description

Khiops Coclustering fails with a segmentation fault on LearningTest/TestCoclustering/Standard/Iris/
⚠️ It is a non-reproductible bug

Context

  • Khiops version 10.2.0
  • Debian 12
@folmos-at-orange folmos-at-orange added the Type/Bug Something isn't working label Feb 21, 2024
@folmos-at-orange
Copy link
Member

@bruno-at-orange
Copy link
Contributor Author

I have made some tests on a docker:

  • The bug does not occur in Debug
  • It is reproducible in Release
  • it is reproducible in Release with debug info 😌 (RELWITHDEBINFO in cmake)
    The backtrace is as follow:
Program received signal SIGSEGV, Segmentation fault.
KWDGPODiscretizerCompareCell (elem1=elem1@entry=0x7ffcae14b880, elem2=elem2@entry=0x7ffcae14b888) at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:576
576				if (cell1->GetPartAt(nAttribute) == cell2->GetPartAt(nAttribute))
(gdb) bt
#0  KWDGPODiscretizerCompareCell (elem1=elem1@entry=0x7ffcae14b880, elem2=elem2@entry=0x7ffcae14b888) at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:576
#1  0x000055cae9cc993c in KWDGPODiscretizer::InitializeHashCellDictionary (this=this@entry=0x7ffcae14bcc0, nkdHashCells=nkdHashCells@entry=0x7ffcae14b8f0, 
    dataGrid=dataGrid@entry=0x7fb3a91dc998) at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:641
#2  0x000055cae9cccaff in KWDGPODiscretizer::InitializeFrequencyTableFromDataGrid (this=this@entry=0x7ffcae14bcc0, kwftFrequencyTable=kwftFrequencyTable@entry=0x7ffcae14b9f0, 
    dataGrid=dataGrid@entry=0x7fb3a91dc998) at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:431
#3  0x000055cae9ccce1a in KWDGPODiscretizer::PostOptimizeDataGrid (this=this@entry=0x7ffcae14bcc0, initialDataGrid=initialDataGrid@entry=0x7fb3a91dc998, dataGridCosts=0x7fb3a8c3a500, 
    optimizedDataGrid=optimizedDataGrid@entry=0x7ffcae14bde0, bDeepPostOptimization=bDeepPostOptimization@entry=false)
    at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:329
#4  0x000055cae9ccdea6 in KWDataGridPostOptimizer::PostOptimizeDataGrid (this=this@entry=0x7ffcae14bd50, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, 
    optimizedDataGrid=optimizedDataGrid@entry=0x7ffcae14bde0, bDeepPostOptimization=bDeepPostOptimization@entry=false)
    at /data/src/Learning/KWDataPreparation/KWDataGridPostOptimizer.cpp:143
#5  0x000055cae9cc6848 in KWDataGridVNSOptimizer::OptimizeSolution (this=this@entry=0x7ffcae14c020, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, 
    dataGridMerger=dataGridMerger@entry=0x7ffcae14bde0) at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:1557
#6  0x000055cae9cc6e2b in KWDataGridVNSOptimizer::VNSOptimizeDataGrid (this=this@entry=0x7ffcae14c020, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, 
    dDecreaseFactor=7.1414284285428504, nMinIndex=nMinIndex@entry=0, nMaxIndex=nMaxIndex@entry=1, optimizedDataGrid=optimizedDataGrid@entry=0x7ffcae14bf40, 
    dOptimizedDataGridCost=dOptimizedDataGridCost@entry=1379.6681770506134) at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:1490
#7  0x000055cae9cc7046 in KWDataGridVNSOptimizer::IterativeVNSOptimizeDataGrid (this=this@entry=0x7ffcae14c020, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, nMaxLevel=4, 
    optimizedDataGrid=optimizedDataGrid@entry=0x7fb3a91dc608) at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:1423
#8  0x000055cae9cc76e5 in KWDataGridVNSOptimizer::OptimizeDataGrid (optimizedDataGrid=0x7fb3a91dc608, initialDataGrid=0x7ffcae14c3f0, this=0x7ffcae14c020)
    at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:1356
#9  KWDataGridOptimizer::VNSOptimize (this=this@entry=0x7ffcae14c5e0, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, optimizedDataGrid=optimizedDataGrid@entry=0x7fb3a91dc608, 
    bIsLastGranularity=bIsLastGranularity@entry=false) at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:1265
#10 0x000055cae9cc7a73 in KWDataGridOptimizer::OptimizeGranularizedDataGrid (this=this@entry=0x7ffcae14c5e0, initialDataGrid=initialDataGrid@entry=0x7ffcae14c3f0, 
    optimizedDataGrid=optimizedDataGrid@entry=0x7fb3a91dc608, bIsLastGranularity=bIsLastGranularity@entry=false, dTotalComputeTime=@0x7ffcae14c338: 0)
    at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:560
#11 0x000055cae9cc809b in KWDataGridOptimizer::OptimizeDataGrid (this=this@entry=0x7ffcae14c5e0, initialDataGrid=initialDataGrid@entry=0x7fb3a91dc1e0, 
    optimizedDataGrid=optimizedDataGrid@entry=0x7ffcae14c8b0) at /data/src/Learning/KWDataPreparation/KWDataGridOptimizer.cpp:266
#12 0x000055cae9b6c40f in CCCoclusteringBuilder::OptimizeDataGrid (this=<optimized out>, inputInitialDataGrid=0x7fb3a91dc1e0, optimizedDataGrid=0x7ffcae14c8b0)
    at /data/src/Learning/MODL_Coclustering/CCCoclusteringBuilder.cpp:264
#13 0x000055cae9b6ff06 in CCCoclusteringBuilder::ComputeCoclustering (this=this@entry=0x7ffcae14cae0) at /data/src/Learning/MODL_Coclustering/CCCoclusteringBuilder.cpp:212
#14 0x000055cae9b8a528 in CCLearningProblem::BuildCoclustering (this=0x7fb3a91c5e50) at /data/src/Learning/MODL_Coclustering/CCLearningProblem.cpp:173
#15 0x000055cae9b91c9c in CCLearningProblemView::BuildCoclustering (this=0x7fb3a8d39370) at /data/src/Learning/MODL_Coclustering/CCLearningProblemView.cpp:161
#16 CCLearningProblemView::BuildCoclustering (this=0x7fb3a8d39370) at /data/src/Learning/MODL_Coclustering/CCLearningProblemView.cpp:145
#17 0x000055cae9f42446 in UIUnit::ExecuteUserActionAt (this=this@entry=0x7fb3a8d39370, sActionId=...) at /data/src/Norm/base/UIUnit.cpp:908
#18 0x000055cae9f44021 in UIUnit::Open (this=0x7fb3a8d39370) at /data/src/Norm/base/UIUnit.cpp:104
#19 0x000055cae9b98525 in KWLearningProject::StartMaster (this=this@entry=0x7ffcae14d4c8, argc=argc@entry=6, argv=argv@entry=0x7ffcae14d5f8)
    at /data/src/Learning/KWLearningProblem/KWLearningProject.cpp:238
#20 0x000055cae9b98955 in KWLearningProject::Start (this=this@entry=0x7ffcae14d4c8, argc=argc@entry=6, argv=argv@entry=0x7ffcae14d5f8)
    at /data/src/Learning/KWLearningProblem/KWLearningProject.cpp:72
#21 0x000055cae9b603dc in main (argc=6, argv=0x7ffcae14d5f8) at /data/src/Learning/MODL_Coclustering/MODL_Coclustering.cpp:44

and we have

(gdb) print nAttribute
$1 = 0
(gdb) print cell1
$2 = (KWDGCell *) 0x7fb3a8aaac20
(gdb) print cell2
$3 = (KWDGCell *) 0x0

@folmos-at-orange
Copy link
Member

Seems like @marcboulle 's domain.

@alexisbondu alexisbondu added the Priority/0 To do NOW label Apr 4, 2024
@bruno-at-orange bruno-at-orange linked a pull request Apr 15, 2024 that will close this issue
bruno-at-orange added a commit that referenced this issue Apr 16, 2024
With gcc 12.2.0 (on debian 12), gcc seems too agressive. The only way to fix a segmentation fault
is to force the optimization level to O1 instead of O2.

The segmentation fault occured while accessing the variable cell1 which is NULL. By adding the
following (unnecessary) line, the segmentation fault vanishes:
if (cell1==NULL or cell2==NULL) exit(1);

cherry pick from dev commit bfc01f0 PR #163
bruno-at-orange added a commit that referenced this issue Apr 16, 2024
With gcc 12.2.0 (on debian 12), gcc seems too agressive. The only way to fix a segmentation fault
is to force the optimization level to O1 instead of O2.

The segmentation fault occured while accessing the variable cell1 which is NULL. By adding the
following (unnecessary) line, the segmentation fault vanishes:
if (cell1==NULL or cell2==NULL) exit(1);

cherry pick from dev commit bfc01f0 PR #163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/0 To do NOW Type/Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants