[issue25323] Bus error: 10 when executing recursive program

2015-10-22 Thread Ronald Oussoren

Ronald Oussoren added the comment:

W.r.t. the bus error on OSX: see issue #18049, the default stack size on OSX is 
too small to reach the default recursion limit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25323] Bus error: 10 when executing recursive program

2015-10-06 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25323] Bus error: 10 when executing recursive program

2015-10-06 Thread Radosław Ejsmont

New submission from Radosław Ejsmont:

When I execute a recursive deep tree reconstruction algorithm (depth ~2) I 
am hitting a bus error 10. I have modified the recursion limit accordingly 
(sys.setrecursionlimit(2)).

I am running python 2.7.10 on OS X 10.11.

The code I am running is here: 
https://github.com/rejsmont/nuclearP/blob/master/src/Compact.py

Function that fails is nfill()

Code runs fine on linux python 2.7.3 or 2.7.9

--
components: Macintosh
messages: 252385
nosy: Radosław Ejsmont, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Bus error: 10 when executing recursive program
type: crash
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25323] Bus error: 10 when executing recursive program

2015-10-06 Thread Mark Dickinson

Mark Dickinson added the comment:

> You may have to enlarge the C stack

The following might work (e.g., in bash shell)

ulimit -s 6

Here the count is in KiB, so that's setting a stack size of about 58.6 MiB.  
There appears to be a system-wide limit of close to 64 MiB, so pushing past 
that could be hard.

Regardless, this isn't really a Python bug: the recursion limit is a safeguard 
that's there precisely to stop you from running into a hard crash.  If you 
remove that safeguard (especially without increasing your process stack size), 
you shouldn't be surprised to get a crash.

As Victor says, you probably need to rework your algorithm.

Suggest closing as "wont fix".

--
nosy: +mark.dickinson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25323] Bus error: 10 when executing recursive program

2015-10-06 Thread eryksun

eryksun added the comment:

I don't know about OS X, but in 64-bit Linux I can increase the recursion limit 
to 10 if I allow the main thread to grow to 64 MiB by setting the 
RLIMIT_STACK soft limit. For example:

soft, hard = resource.getrlimit(resource.RLIMIT_STACK)
soft = max(soft, 64 << 20)
if hard != resource.RLIM_INFINITY:
soft = min(soft, hard)
resource.setrlimit(resource.RLIMIT_STACK, (soft, hard))

Alternatively it also works to use a worker thread with a fixed 64 MiB stack 
size, set as follows:

old_size = threading.stack_size(64 << 20)
# create worker thread
threading.stack_size(old_size)

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25323] Bus error: 10 when executing recursive program

2015-10-06 Thread STINNER Victor

STINNER Victor added the comment:

Well, Python tries to protect you against stack overflow, but the protection is 
not perfect. You may have to enlarge the C stack, but I don't know how.

Workaround: try to rewrite your algorithm to use a lower recursion depth.

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com