POV-Ray : Newsgroups : povray.beta-test : Might need a bigger stack for refraction & glass Server Time
29 Dec 2024 12:36:12 EST (-0500)
  Might need a bigger stack for refraction & glass (Message 1 to 9 of 9)  
From: Le Forgeron
Subject: Might need a bigger stack for refraction & glass
Date: 21 Jul 2012 11:36:34
Message: <500acc82$1@news.povray.org>
Greeting,

Trying to make a bit of tutorial (how to make glass with liquid without
coincident surface), I was hit by an issue with the stack size.

After 732 function calls, it dumped a core, when entering
ComputeTextureColour from Trace::

How to reproduce: povray -Iglass1.pov +H300 +W600 +A0.0001

Notice that the limit is 255 (and that seems legal).

Lowering the limit to 155 with only the left transparent cylinder is ok,
but still crash once the right cylinder get the same material.

Technical details: povray 3.7RC6, 64 bits linux system.
Compiler seems irrevelant (g++ as well as icpc)

(debug done on g++ version)

Any suggestion (short of limiting the trace level to 5 ) ?


Post a reply to this message


Attachments:
Download 'glass1.pov.txt' (7 KB)

From: Thorsten Froehlich
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 04:05:00
Message: <500bb42c$1@news.povray.org>
On 21.07.12 17:36, Le_Forgeron wrote:
> Notice that the limit is 255 (and that seems legal).
>
> Lowering the limit to 155 with only the left transparent cylinder is ok,
> but still crash once the right cylinder get the same material.

The default thread stack size in Linux is too small. It is not possible with 
standard boost threads to change the stack size. Early versions of POV-Ray 
3.7 beta used a patched boost thread implementation. However, it seems this 
change and the knowledge about its necessity had been lost over time. Either 
way, for 3.71 we have fixed code ready. It won't make it into 3.70 though.

	Thorsten


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 04:11:52
Message: <500bb5c8$1@news.povray.org>
On 21.07.12 17:36, Le_Forgeron wrote:
> Any suggestion (short of limiting the trace level to 5 )

BTW, I thing you can change he Linux default thread stack size with ulimit 
RLIMIT_STACK.

     Thorsten


Post a reply to this message

From: Le Forgeron
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 04:43:38
Message: <500bbd3a$1@news.povray.org>
Le 22/07/2012 10:11, Thorsten Froehlich nous fit lire :
> On 21.07.12 17:36, Le_Forgeron wrote:
>> Any suggestion (short of limiting the trace level to 5 )
> 
> BTW, I thing you can change he Linux default thread stack size with
> ulimit RLIMIT_STACK.

Is that to be called by the thread itself, or can the first thread be
enough to apply to 'forked' threads too ?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 05:08:47
Message: <500bc31f$1@news.povray.org>
On 22.07.12 10:43, Le_Forgeron wrote:
> Le 22/07/2012 10:11, Thorsten Froehlich nous fit lire :
>> On 21.07.12 17:36, Le_Forgeron wrote:
>>> Any suggestion (short of limiting the trace level to 5 )
>>
>> BTW, I thing you can change he Linux default thread stack size with
>> ulimit RLIMIT_STACK.
>
> Is that to be called by the thread itself, or can the first thread be
> enough to apply to 'forked' threads too ?

ulimit is a command line program:
http://www.google.com/search?q=linux+man+ulimit

	Thorsten


Post a reply to this message

From: Le Forgeron
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 05:28:11
Message: <500bc7ab$1@news.povray.org>
Le 22/07/2012 11:08, Thorsten Froehlich nous fit lire :
> On 22.07.12 10:43, Le_Forgeron wrote:
>> Le 22/07/2012 10:11, Thorsten Froehlich nous fit lire :
>>> On 21.07.12 17:36, Le_Forgeron wrote:
>>>> Any suggestion (short of limiting the trace level to 5 )
>>>
>>> BTW, I thing you can change he Linux default thread stack size with
>>> ulimit RLIMIT_STACK.
>>
>> Is that to be called by the thread itself, or can the first thread be
>> enough to apply to 'forked' threads too ?
> 
> ulimit is a command line program:
> http://www.google.com/search?q=linux+man+ulimit

I was afraid of that: tried it already (before posting first post of
this thread: ulimit -s has no effect (tried: it's a limit, not an
allocation size which is done by the compiler/linker code...)

One hope which remains is recompiling with specific options.
I have to try -fstack-check , and maybe -fno-stack-limit
... for gnu.

I wonder about the flag (if any) for intel compiler (icpc)


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 13:44:16
Message: <500c3bf0$1@news.povray.org>
On 22.07.12 11:28, Le_Forgeron wrote:
> I was afraid of that: tried it already (before posting first post of
> this thread: ulimit -s has no effect (tried: it's a limit, not an
> allocation size which is done by the compiler/linker code...)
>
> One hope which remains is recompiling with specific options.
> I have to try -fstack-check , and maybe -fno-stack-limit
> ... for gnu.
>
> I wonder about the flag (if any) for intel compiler (icpc)

Neither compiler nor linker have anything to do with it. The flags you list 
have nothing to do with the stack size set for threads either.

You need superuser rights to set the limit higher than the maximum set by 
the superuser. As user you can only set it to the maximum the superuser has 
permitted.

	Thorsten


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Might need a bigger stack for refraction & glass
Date: 22 Jul 2012 14:00:01
Message: <web.500c3f44433eec419ab80c680@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> On 22.07.12 11:28, Le_Forgeron wrote:
> > I was afraid of that: tried it already (before posting first post of
> > this thread: ulimit -s has no effect (tried: it's a limit, not an
> > allocation size which is done by the compiler/linker code...)
> >
> > One hope which remains is recompiling with specific options.
> > I have to try -fstack-check , and maybe -fno-stack-limit
> > ... for gnu.
> >
> > I wonder about the flag (if any) for intel compiler (icpc)
>
> Neither compiler nor linker have anything to do with it. The flags you list
> have nothing to do with the stack size set for threads either.
>
> You need superuser rights to set the limit higher than the maximum set by
> the superuser. As user you can only set it to the maximum the superuser has
> permitted.

Note that you need a 2.6 kernel and a not ancient gcc. See
http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_create.3.html and
http://en.wikipedia.org/wiki/Native_POSIX_Thread_Library . It explains how to
use ulimit -s correctly and work with threads as expected.

Thorsten


Post a reply to this message

From: Le Forgeron
Subject: Re: Might need a bigger stack for refraction & glass
Date: 4 Aug 2012 11:18:22
Message: <501d3d3e$1@news.povray.org>
Le 22/07/2012 10:04, Thorsten Froehlich nous fit lire :
> On 21.07.12 17:36, Le_Forgeron wrote:
>> Notice that the limit is 255 (and that seems legal).
>>
>> Lowering the limit to 155 with only the left transparent cylinder is ok,
>> but still crash once the right cylinder get the same material.
> 
> The default thread stack size in Linux is too small. It is not possible
> with standard boost threads to change the stack size. Early versions of
> POV-Ray 3.7 beta used a patched boost thread implementation. However, it
> seems this change and the knowledge about its necessity had been lost
> over time. Either way, for 3.71 we have fixed code ready. It won't make
> it into 3.70 though.
> 
>     Thorsten
> 

A hope, from boost: 1.50 get Thread v3, with API to get & set stack size.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.