ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 02 Oct 2020 13:52:26 +0200Segmentation fault (core dumped) SageMath version 8.2https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/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_segfault/test_maxima.sage
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.Tue, 19 Jun 2018 15:20:18 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/Answer by tmonteil for <p>Sage still core dumps. I thought earlier it was fixed, but it is not.</p>
<pre><code> /usr/bin/sage-python: line 2: 2794 Segmentation fault (core dumped) sage -python "$@"
</code></pre>
<p><strong>Short summary of the problem</strong>: 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)</p>
<p>When I change the algorithm from "maxima" to "fricas", the script runs and it works. NO OTHER CHNAGES.</p>
<p>When the list is short, using maxima no longer causes a segfault. So it seems like a memory corruption for me. </p>
<p>Why when the list is short it works, but when adding one more entry to the list, it segfault? And only when using maxima? </p>
<p>The script uses Python multiprocessing. </p>
<p>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 <a href="https://www.12000.org/tmp/sage_segfault/test_maxima.sage">https://www.12000.org/tmp/sage_segfau...</a></p>
<p>To run, simply download to any folder and type <code>./test_maxima.sage</code></p>
<p>It will segfault. I tried it on <strong>sage 8.2</strong>, <strong>sage 8.1</strong>, <strong>sage 8.3 beta 6</strong>. On latest <strong>Manjora linux 17.1</strong> and also on <strong>Linux mint 19</strong> and tried it on standalone PC running Linux and inside Virtual box running Linux.</p>
<p>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.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?answer=42665#post-id-42665On 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.
Tue, 19 Jun 2018 15:30:48 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?answer=42665#post-id-42665Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42666#post-id-42666Thanks 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.Tue, 19 Jun 2018 15:35:03 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42666#post-id-42666Comment by tmonteil for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42667#post-id-42667I would suggest to compile from source, see http://doc.sagemath.org/html/en/installation/source.htmlTue, 19 Jun 2018 15:55:28 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42667#post-id-42667Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42668#post-id-42668I 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.Tue, 19 Jun 2018 16:04:00 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42668#post-id-42668Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42674#post-id-42674fyi, I installed 8.3 beta6 on Manjora and the core dump went away !! So it was a bug somewjere, but fixed now. THanksTue, 19 Jun 2018 19:53:55 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42674#post-id-42674Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42669#post-id-42669hi, 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 dumpTue, 19 Jun 2018 16:34:59 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42669#post-id-42669Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42677#post-id-42677I am sorry, but the core dump is still there. I was wrong. I did not notice it. So the issue is still there. Will update the question as I found why it happens, but not how to fix it.Wed, 20 Jun 2018 04:18:18 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42677#post-id-42677Comment by Nasser for <p>On Debian GNU/Linux, with Sage 8.3 beta6 compiled from source, i can not reproduce your problem, the computation ends with:</p>
<pre><code>>>>>>>>> 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
</code></pre>
<p>It is very cool that manjaro is distributing sagemath, but perhaps they lack feedback to see those bugs.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42678#post-id-42678Could you please try again with the new script I just posted? ThanksWed, 20 Jun 2018 04:29:17 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=42678#post-id-42678Answer by Nasser for <p>Sage still core dumps. I thought earlier it was fixed, but it is not.</p>
<pre><code> /usr/bin/sage-python: line 2: 2794 Segmentation fault (core dumped) sage -python "$@"
</code></pre>
<p><strong>Short summary of the problem</strong>: 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)</p>
<p>When I change the algorithm from "maxima" to "fricas", the script runs and it works. NO OTHER CHNAGES.</p>
<p>When the list is short, using maxima no longer causes a segfault. So it seems like a memory corruption for me. </p>
<p>Why when the list is short it works, but when adding one more entry to the list, it segfault? And only when using maxima? </p>
<p>The script uses Python multiprocessing. </p>
<p>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 <a href="https://www.12000.org/tmp/sage_segfault/test_maxima.sage">https://www.12000.org/tmp/sage_segfau...</a></p>
<p>To run, simply download to any folder and type <code>./test_maxima.sage</code></p>
<p>It will segfault. I tried it on <strong>sage 8.2</strong>, <strong>sage 8.1</strong>, <strong>sage 8.3 beta 6</strong>. On latest <strong>Manjora linux 17.1</strong> and also on <strong>Linux mint 19</strong> and tried it on standalone PC running Linux and inside Virtual box running Linux.</p>
<p>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.</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?answer=42679#post-id-42679
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
Wed, 20 Jun 2018 08:54:54 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?answer=42679#post-id-42679Comment by slelievre for <p>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. </p>
<p>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.</p>
<p>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. </p>
<p>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.</p>
<p>Now sage no longer segfaults. Again, I do not know why it worked OK with fricas and not with maxima. </p>
<p>Case resolved.</p>
<p>Thank you</p>
<p>--Nasser</p>
https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=53700#post-id-53700Please accept your answer to mark the question as solved.Fri, 02 Oct 2020 13:52:26 +0200https://ask.sagemath.org/question/42664/segmentation-fault-core-dumped-sagemath-version-82/?comment=53700#post-id-53700