Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
pari_close causing segfault
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jason Grout  
View profile  
 More options Sep 13 2012, 11:37 am
From: Jason Grout <jason-s...@creativetrax.com>
Date: Thu, 13 Sep 2012 10:37:28 -0500
Local: Thurs, Sep 13 2012 11:37 am
Subject: pari_close causing segfault
I've rewritten the code for moving to the new IPython to make it more
flexible, and I'm running into a puzzling problem.  When I call
quit_sage from an exit handler, for some reason the pari_close() call
happening inside the pari._unsafe_deallocate_pari_stack function causes
a segfault.  This only happens (in my testing) when all of the following
are true:

* the exit handler is called in a particular way (triggered from the
IPython shutdown hook)

* sage is doctesting a file that creates an IPython test shell.  When
running the doctests with gdb, after all of the doctests are done, the
program segfaults and gdb reports this error:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000011
0x000000010156dac8 in pari_close ()
(gdb) where
#0  0x000000010156dac8 in pari_close ()
#1  0x0000000102bf0bd7 in
__pyx_pw_4sage_4libs_4pari_3gen_12PariInstance_3_unsafe_deallocate_pari_sta ck
(__pyx_v_self=<value temporarily unavailable, due to optimizations>,
unused=<value temporarily unavailable, due to optimizations>) at
sage/libs/pari/gen.c:46888
Previous frame inner to this frame (gdb could not unwind past this frame)

I realize this is really vague, so I might need to put up more details
or the code.  But I'm curious at this point if someone has even a clue
about what might be happening.  What would cause an error like I'm seeing?

Thanks,

Jason

P.S. This is what I'm seeing when I doctest:

% sage -t interpreter.py
sage -t  "devel/sage-main/sage/misc/interpreter.py"
The doctested process was killed by signal 11
         [5.8 s]

----------------------------------------------------------------------
The following tests failed:

        sage -t  "devel/sage-main/sage/misc/interpreter.py" # Killed/crashed
Total time for all tests: 5.8 seconds


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Simon King  
View profile  
 More options Sep 13 2012, 11:56 am
From: Simon King <simon.k...@uni-jena.de>
Date: Thu, 13 Sep 2012 15:56:30 +0000 (UTC)
Local: Thurs, Sep 13 2012 11:56 am
Subject: Re: pari_close causing segfault
Hi Jason,

On 2012-09-13, Jason Grout <jason-s...@creativetrax.com> wrote:

> I've rewritten the code for moving to the new IPython to make it more
> flexible, and I'm running into a puzzling problem.  When I call
> quit_sage from an exit handler, for some reason the pari_close() call
> happening inside the pari._unsafe_deallocate_pari_stack function causes
> a segfault.

I've met the same problem, and I my suggestion for a solution is at
#12215 (second patch): Simply rename _unsafe_deallocate_pari_stack into
__dealloc__, and remove the explicit call to
_unsafe_deallocate_pari_stack in sage.all.quit_sage.

I think that's the cleanest solution: As usual with Cython, if you
have C data that need to be freed when the object is deleted, then do so
in __dealloc__. When a (or actually *the unique*) pari
instance becomes garbage collected (or when quitting Sage), then
__dealloc__ is called anyway - there is absolutely no need to manually
deallocate.

The problem with #12215 is that it depends on #715 and #11521, which are
uncovering a problem in libsingular/omalloc that results in a
segmentation fault on bsd.math -- see #13447.

So, it might be a good idea to fix the pari problem independent of all
the memleak fixes in #715 and #11521, if it turns out that pari
deallocation is troublesome in other contexts as well.

Cheers,
Simon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »