Does anyone know what might be the causes of a segfault after a few iterations using iminuit.migrad ?

MIGRAD *

When x = [-8.0, 20.0] the chi2 is 11.4978287718
When x = [-7.99, 20.0] the chi2 is 11.4689955581
When x = [-8.01, 20.0] the chi2 is 11.3893762167
When x = [-7.999, 20.0] the chi2 is 11.494925775
When x = [-8.001, 20.0] the chi2 is 11.5007360115
When x = [-8.0, 20.01] the chi2 is 11.4637096657
When x = [-8.0, 19.99] the chi2 is 11.8324189851
When x = [-8.0, 20.001] the chi2 is 11.4968683948
When x = [-8.0, 19.999] the chi2 is 11.6500742441
When x = [-8.0, 20.0001] the chi2 is 11.4977324544
When x = [-8.0, 19.9999] the chi2 is 11.4979251324
When x = [-7.31530404191, 20.223279636] the chi2 is 12.226079488
When x = [-7.74267059281, 20.0839152265] the chi2 is 11.6402489403
When x = [-7.89021022067, 20.0358024926] the chi2 is 11.6483843306
When x = [-7.96150339823, 20.0125537578] the chi2 is 11.4067962111
When x = [-7.96032258332, 20.0125537578] the chi2 is 11.403450664
When x = [-7.96268421315, 20.0125537578] the chi2 is 11.487640618
When x = [-7.96138531674, 20.0125537578] the chi2 is 11.4064614103
When x = [-7.96162147973, 20.0125537578] the chi2 is 11.4071311186
When x = [-7.96062379708, 20.0125537578] the chi2 is 11.4043035067
When x = [-7.96238299939, 20.0125537578] the chi2 is 11.4867879865
When x = [-7.96150339823, 20.0135537578] the chi2 is 11.405780992
When x = [-7.96150339823, 20.0115537578] the chi2 is 11.4078175146

===========================================================
There was a crash.

This is the entire stack trace of all threads:

Thread 2 (Thread 0x7f1bf234b700 (LWP 5502)): #0 0x00007f1c10472adb in do_futex_wait.constprop () from /lib64/libpthread.so.0 #1 0x00007f1c10472b6f in __new_sem_wait_slow.constprop.0 () from /lib64/libpthread.so.0 #2 0x00007f1c10472c0b in sem_wait

Thanks. So the crash is in #6 0x00007fc353ae8daf in ROOT::Minuit2::VariableMetricBuilder::Minimum(ROOT::Minuit2::MnFcn const&, ROOT::Minuit2::GradientCalculator const&, ROOT::Minuit2::MinimumSeed const&, std::vector<ROOT::Minuit2::MinimumState, std::allocator<ROOT::Minuit2::MinimumState> >&, unsigned int, double) const. @moneta could you advise?

You should be able to use MINUIT instead of Minuit2 - that might work around the problem.

I suspect the cause of the crash is in the evaluation of the user function that you pass to Minuit. You can try to use just Minuit to see if it works, but it would be better of you can send us your code so we can reproduce and investigate the problem