#5278: On modern fedora 64 installs, sage exists frequently when omalloc things
there is no memory left
---------------------+------------------------------------------------------
 Reporter:  was      |        Owner:  cwitty  
     Type:  defect   |       Status:  new     
 Priority:  blocker  |    Milestone:  sage-3.3
Component:  misc     |   Resolution:          
 Keywords:           |  
---------------------+------------------------------------------------------
Old description:

> This is show-stopper bug for using Sage on any modern install of Fedora.
> It was discussed a lot in sage-devel.
>
> To replicate this issue, install Sage on fedora 64-bit and run a doctest
> a few times.  Every so often (maybe 20% chance) it will exit with this
> error:
> {{{
> error: no more memory
> System 0k:0k Appl 0k/0k Malloc 0k/0k Valloc 0k/0k Pages 0/0 Regions 0:0
> }}}
>
> Tracing this through with print statements I found that this happens
> around line 370 of singular.spkg's omalloc/omAllocSystem.c (something
> similar was posted to sage-devel):
> {{{
> void* omAllocFromSystem(size_t size)
> {
>   void* ptr;
>
>   ptr = OM_MALLOC_FROM_SYSTEM(size);
>   if (ptr == NULL)
>   {
>     OM_MEMORY_LOW_HOOK();
>     ptr = OM_MALLOC_FROM_SYSTEM(size);
>     if (ptr == NULL)
>          BOOM (crash handler called!)
> }}}
>
> The first thing that is suspicious is that OM_MALLOC_FROM_SYSTEM is
> called, fails, and then is called again... for now reason.  That is very
> hackish code.  Tracing that through it seemed to me that
> OM_MALLOC_FROM_SYSTEM should just be the system malloc.
> To test that theory I modified the above code as follows:
> void* omAllocFromSystem(size_t size)
> {
>   void* ptr;
>
>   ptr = OM_MALLOC_FROM_SYSTEM(size);
>   if (ptr == NULL)
>   {
>     OM_MEMORY_LOW_HOOK();
>     ptr = OM_MALLOC_FROM_SYSTEM(size);
>     if (ptr == NULL)
>        ptr = malloc(size);
>        if (ptr == NULL)
>          BOOM (crash handler called!)
> }}}
>
> After making that change, the problem vanishes (for me) and doctesting
> works fine again, at least for me.  I haven't tested doctesting the whole
> tree.

New description:

 This is show-stopper bug for using Sage on any modern install of Fedora.
 It was discussed a lot in sage-devel.

 To replicate this issue, install Sage on fedora 64-bit and run a doctest a
 few times.  Every so often (maybe 20% chance) it will exit with this
 error:
 {{{
 error: no more memory
 System 0k:0k Appl 0k/0k Malloc 0k/0k Valloc 0k/0k Pages 0/0 Regions 0:0
 }}}

 Tracing this through with print statements I found that this happens
 around line 370 of singular.spkg's omalloc/omAllocSystem.c (something
 similar was posted to sage-devel):
 {{{
 void* omAllocFromSystem(size_t size)
 {
   void* ptr;

   ptr = OM_MALLOC_FROM_SYSTEM(size);
   if (ptr == NULL)
   {
     OM_MEMORY_LOW_HOOK();
     ptr = OM_MALLOC_FROM_SYSTEM(size);
     if (ptr == NULL)
          BOOM (crash handler called!)
 }}}

 The first thing that is suspicious is that OM_MALLOC_FROM_SYSTEM is
 called, fails, and then is called again... for now reason.  That is very
 hackish code.  Tracing that through it seemed to me that
 OM_MALLOC_FROM_SYSTEM should just be the system malloc.
 To test that theory I modified the above code as follows:
 {{{
 void* omAllocFromSystem(size_t size)
 {
   void* ptr;

   ptr = OM_MALLOC_FROM_SYSTEM(size);
   if (ptr == NULL)
   {
     OM_MEMORY_LOW_HOOK();
     ptr = OM_MALLOC_FROM_SYSTEM(size);
     if (ptr == NULL)
        ptr = malloc(size);
        if (ptr == NULL)
          BOOM (crash handler called!)
 }}}

 After making that change, the problem vanishes (for me) and doctesting
 works fine again, at least for me.  I haven't tested doctesting the whole
 tree.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5278#comment:1>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to