Ask Your Question
1

Segmentation fault (core dumped) SageMath version 8.2

asked 2018-06-19 15:20:18 +0100

Nasser gravatar image

updated 2018-06-20 04:34:46 +0100

Sage still core dumps. I thought earlier it was fixed, but it is not.

 /usr/bin/sage-python: line 2:  2794 Segmentation fault      (core dumped) sage -python "$@"

Short summary of the problem: When I run a sage script which iterates over large list of integrals, then call maxima, it segfault, but only when the list is long. (trial and error shows when it is over 45 entries)

When I change the algorithm from "maxima" to "fricas", the script runs and it works. NO OTHER CHNAGES.

When the list is short, using maxima no longer causes a segfault. So it seems like a memory corruption for me.

Why when the list is short it works, but when adding one more entry to the list, it segfault? And only when using maxima?

The script uses Python multiprocessing.

The script is long, but only because the list is long. So I was not sure if I should post it here. (I could if needed) but I put a link to it here. Please see https://www.12000.org/tmp/sage_segfau...

To run, simply download to any folder and type ./test_maxima.sage

It will segfault. I tried it on sage 8.2, sage 8.1, sage 8.3 beta 6. On latest Manjora linux 17.1 and also on Linux mint 19 and tried it on standalone PC running Linux and inside Virtual box running Linux.

Could someone please try this script to see if they get the segfault? Otherwise, I could not test maxima for integration and will have just leave it out. I do not know where the dump file is written to. Does any one know? I do not see it in same folder I am running the script from.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-06-19 15:30:48 +0100

tmonteil gravatar image

On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:

>>>>>>>> doing integral number  97
before creating process
before p.start()
before p.join()
inside doTheIntegration, finished!!
after p.join()
result returned Ok, check it later


>>>>>>>> doing integral number  98
before creating process
before p.start()
before p.join()
inside doTheIntegration, finished!!
after p.join()
result returned Ok, check it later


>>>>>>>> doing integral number  99
before creating process
before p.start()
before p.join()
inside doTheIntegration, finished!!
after p.join()
result returned Ok, check it later
finished

It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.

edit flag offensive delete link more

Comments

Thanks for checking. How else can I install sagemath other than using Manjaro package manager? It was easy. I just clicked on a button and did install. I will try to run this on Linux mint. But there, I did not see sagemath listed in its package manager, that is why I used Manjaro.

Nasser gravatar imageNasser ( 2018-06-19 15:35:03 +0100 )edit

I would suggest to compile from source, see http://doc.sagemath.org/html/en/insta...

tmonteil gravatar imagetmonteil ( 2018-06-19 15:55:28 +0100 )edit

I am actually running sudo apt-get install sagemath on Linux mint now. and it is downloading 1.2 GB of stuff., Will see if this works better than Manjaro. If so, I will switch to Linux mint. I looked at steps to compile from source. Too much.

Nasser gravatar imageNasser ( 2018-06-19 16:04:00 +0100 )edit

hi, Could you please try with 8.2 or 8.1 if you have these installed on your box? I just tried it on Linux mint, with sage 8.1, and it core dumped there as well. Same exact place. I wonder now if it has to do that I am running Linux on a virtual box? But I had no problem running the same type of script using Python 3.6.5 and sympy 1.1.1 on hundreds of integrals. No problem. on same VBox. Only with sage I get the core dump

Nasser gravatar imageNasser ( 2018-06-19 16:34:59 +0100 )edit

fyi, I installed 8.3 beta6 on Manjora and the core dump went away !! So it was a bug somewjere, but fixed now. THanks

Nasser gravatar imageNasser ( 2018-06-19 19:53:55 +0100 )edit
1

answered 2018-06-20 08:54:54 +0100

Nasser gravatar image

Just found out the cause of the seqgfault and fixed it. I do not know why it only segfaulted with maxima and not with fricas, but it is now fixed.

I was using Python multiprocessing to set a timeout on the integration by spawning a process to do the integration and then using join(time_out) on it. Passing the integral and getting the result back through a Python Queue.

It turned out that I had to use new Queue each time I spawn process, because when terminating a spawned process (when it times out) can end up corrupting the active Queue. This causes the next process which wants to use the same queue to segfault.

The fix was simple. Changed the code to create new Queue and then delete at end of integration step. So a new Queue is now used for each process, instead of the same Queue as before.

Now sage no longer segfaults. Again, I do not know why it worked OK with fricas and not with maxima.

Case resolved.

Thank you

--Nasser

edit flag offensive delete link more

Comments

Please accept your answer to mark the question as solved.

slelievre gravatar imageslelievre ( 2020-10-02 13:52:26 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-06-19 15:20:18 +0100

Seen: 1,145 times

Last updated: Jun 20 '18