POV-Ray : Newsgroups : povray.beta-test : julia_fractal/trace() crash Server Time
31 Oct 2024 10:21:47 EDT (-0400)
  julia_fractal/trace() crash (Message 1 to 4 of 4)  
From: Edouard Poor
Subject: julia_fractal/trace() crash
Date: 14 Mar 2009 03:05:00
Message: <web.49bb56f517918aed506891550@news.povray.org>
I was creating some scenes to test my 35mm Camera macros, but when I ran the
autofocus test on a Julia fractal, I got a crash.

OS: Mac OS X 10.5.6
Arch: Intel (Core 2 Duo @ 1.6GHz)
Version: POV-Ray v3.7.0.beta.31 (by Yvo Smellenbergh)

Expected Result: trace() macro returns the interesction point on the
julia_fractal object.
Actual Result: POVRay go boom.

Scene:

#declare camera_location = <5, 1000, -1000>;
#declare look_at_location = <0,120,0>;

light_source { < 5000, 10000, -10000> rgb 1 }

camera {
 perspective
 location camera_location
 look_at look_at_location
 angle 20
 right x * 1
 up y * image_height/image_width
}

#declare obj =
 julia_fractal {
  <-0.03,0.01,-0.99,-0.025>
  quaternion
  sqr
  max_iteration 8
  precision 1000
  pigment { rgb 1 }
  scale 150 translate y*150 rotate y*-75
 }

#declare intersection_normal = <0,0,0>;
#declare intersection_point = trace( obj, camera_location, look_at_location -
camera_location, intersection_normal );

sphere { intersection_point, 10 pigment { rgb <1,0,0> } }
object { obj }




Stack trace:

Thread 6 Crashed:
0   org.megapov.macmegapov         0x0027d965 pov::D_Iteration_Julia(double*,
pov::Fractal const*, double const (&) [3], double*, double**) + 37
1   org.megapov.macmegapov         0x0027bd86
pov::Fractal::All_Intersections(pov::Ray&,
pov::Ref<std::stack<pov::Intersection, std::vector<pov::Intersection,
std::allocator<pov::Intersection> > >,
pov::RefClearDefault<std::stack<pov::Intersection,
std::vector<pov::Intersection, std::allocator<pov::Intersection> > > > >&,
pov::SceneThreadData const*) + 550
2   org.megapov.macmegapov         0x0019a8e6
pov::Find_Intersection(pov::Intersection*, pov::ObjectBase*, pov::Ray&,
pov::SceneThreadData const*) + 294
3   org.megapov.macmegapov         0x00264808 pov::Parser::Parse_Trace(double*)
+ 408
4   org.megapov.macmegapov         0x00260069
pov::Parser::Parse_Num_Factor(double*, int*) + 4041
5   org.megapov.macmegapov         0x002621e2
pov::Parser::Parse_Num_Term(double*, int*) + 34
6   org.megapov.macmegapov         0x00262ff2
pov::Parser::Parse_Rel_Factor(double*, int*) + 34
7   org.megapov.macmegapov         0x0026403a
pov::Parser::Parse_Unknown_Vector(double*, bool, bool*) + 218
8   org.megapov.macmegapov         0x001bb85f pov::Parser::Parse_RValue(int,
int*, void**, pov::Sym_Table_Entry*, bool, bool, bool, bool, int) + 735
9   org.megapov.macmegapov         0x001bcc08 pov::Parser::Parse_Declare(bool,
bool) + 568
10  org.megapov.macmegapov         0x002a3b87 pov::Parser::Parse_Directive(int)
+ 5383
11  org.megapov.macmegapov         0x002a4cdf pov::Parser::Get_Token() + 2287
12  org.megapov.macmegapov         0x001b8348 pov::Parser::Parse_Frame() + 24
13  org.megapov.macmegapov         0x001b8ca4 pov::Parser::Run() + 660
14  org.megapov.macmegapov         0x00276636
pov::Task::TaskThread(boost::function0<void> const&) + 214
15  org.megapov.macmegapov         0x0027704f
boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void,
pov::Task, boost::function0<void> const&>,
boost::_bi::list2<boost::_bi::value<pov::Task*>,
boost::_bi::value<boost::function0<void> > > > >::run() + 95
16  org.megapov.macmegapov         0x002d5ca2 thread_proxy + 130
17  libSystem.B.dylib              0x96284095 _pthread_start + 321
18  libSystem.B.dylib              0x96283f52 thread_start + 34



Cheers,
Edouard.


Post a reply to this message

From: Le Forgeron
Subject: Re: julia_fractal/trace() crash
Date: 14 Mar 2009 08:22:56
Message: <49bba1a0$1@news.povray.org>
Le 14.03.2009 08:04, Edouard Poor nous fit lire :
> I was creating some scenes to test my 35mm Camera macros, but when I ran the
> autofocus test on a Julia fractal, I got a crash.
> 
>
Confirmed, 3.7b31 on Linux Amd64 3500+


May be the problem is about IterStack being empty:
(gdb) p *IterStack
$8 = (double *) 0x0


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x43723950 (LWP 29742)]
pov::D_Iteration_Julia (point=0x43721c50, Julia=0x1508400, Dist=0x43721cb8,
    IterStack=0x14d2ef8) at math/quatern.cpp:416
416       x = IterStack[X][0] = point[X];

(gdb) where
#0  pov::D_Iteration_Julia (point=0x43721c50, Julia=0x1508400,
    Dist=0x43721cb8, IterStack=0x14d2ef8) at math/quatern.cpp:416
#1  0x00000000004eae17 in pov::Fractal::All_Intersections (this=0x1508400,
    ray=<value optimized out>, Depth_Stack=@0x43722070, Thread=0x14d2ee0)
    at shape/fractal.cpp:239
#2  0x0000000000473537 in pov::Find_Intersection (isect=0x43722100,
    object=0x1508400, ray=@0x43722240, threadData=0x14d2ee0)
    at scene/objects.cpp:188
#3  0x000000000056ed14 in pov::Parser::Parse_Trace (this=0x14d1d50,
    Res=0x437226e0) at parser/express.cpp:320
#4  0x000000000056a89b in pov::Parser::Parse_Num_Factor (this=0x14d1d50,
    Express=0x437228e0, Terms=0x4372289c) at parser/express.cpp:1116
#5  0x000000000056c0ac in pov::Parser::Parse_Num_Term (this=0x43721c50,
    Express=0x1508400, Terms=0x43721bd0) at parser/express.cpp:1531
#6  0x000000000056c52f in pov::Parser::Parse_Rel_Factor (this=0x43721c50,
    Express=0x1508400, Terms=0x43721bd0) at parser/express.cpp:1604
#7  0x000000000056dd29 in pov::Parser::Parse_Unknown_Vector
(this=0x14d1d50,
    Express=0x1508400, allow_identifier=<value optimized out>,
    had_identifier=0x4372295f) at parser/express.cpp:2271
#8  0x00000000004b2da7 in pov::Parser::Parse_RValue (this=0x14d1d50,
    Previous=154, NumberPtr=0x1508b70, DataPtr=0x1508b68,
    sym=<value optimized out>, ParFlag=false, SemiFlag=true,
is_local=false,
    allow_redefine=true, old_table_index=100) at parser/parse.cpp:8090
#9  0x00000000004b49b2 in pov::Parser::Parse_Declare (this=0x14d1d50,
    is_local=true, after_hash=true) at parser/parse.cpp:7963
#10 0x00000000004d0ab7 in pov::Parser::Parse_Directive (this=0x14d1d50,
    After_Hash=1) at parser/tokenize.cpp:2054
#11 0x00000000004d2582 in pov::Parser::Get_Token (this=0x14d1d50)
    at parser/tokenize.cpp:494
#12 0x00000000004bddf8 in pov::Parser::Parse_Frame (this=0x14d1d50)
    at parser/parse.cpp:6221
#13 0x00000000004be7f7 in pov::Parser::Run (this=0x14d1d50)
    at parser/parse.cpp:280
#14 0x000000000055e5ee in pov::Task::TaskThread (this=0x14d1d50,
    completion=@0x14d0210) at support/task.cpp:233
#15 0x00007fd3e98d193f in thread_proxy ()
   from /usr/local/lib/libboost_thread-gcc43-mt-1_38.so.1.38.0
#16 0x00007fd3e8f053ea in start_thread () from /lib/libpthread.so.0
#17 0x00007fd3e8c72cbd in clone () from /lib/libc.so.6
#18 0x0000000000000000 in ?? ()


Post a reply to this message

From: Carlo C 
Subject: Re: julia_fractal/trace() crash
Date: 14 Mar 2009 09:05:00
Message: <web.49bbab1ea2f5b4ffdb1b8dbe0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
> Le 14.03.2009 08:04, Edouard Poor nous fit lire :
> > I was creating some scenes to test my 35mm Camera macros, but when I ran the
> > autofocus test on a Julia fractal, I got a crash.

Confirmed, 3.7b31 on Windows Xp SP3.


--
Carlo


Post a reply to this message

From: Le Forgeron
Subject: Re: julia_fractal/trace() crash
Date: 13 Apr 2009 08:21:42
Message: <49e32e56@news.povray.org>
Le 14.03.2009 14:03, Carlo C. nous fit lire :
> Le_Forgeron <jgr### [at] freefr> wrote:
>> Le 14.03.2009 08:04, Edouard Poor nous fit lire :
>>> I was creating some scenes to test my 35mm Camera macros, but when I ran the
>>> autofocus test on a Julia fractal, I got a crash.
> 
> Confirmed, 3.7b31 on Windows Xp SP3.

Proposal of at least a workaround (I find it ugly but it works), based on beta 32:
Updating the parser-thread Stack at the same time as the limit of stack is updated.
For rendering threads, they will use, as previously, the stack allocated from the
limit.

Why it's ugly: the fractal object need to know about the parser!


diff -r 562a27c89044 source/backend/parser/parse.cpp
--- a/source/backend/parser/parse.cpp   Mon Apr 13 14:05:24 2009 +0200
+++ b/source/backend/parser/parse.cpp   Mon Apr 13 14:13:17 2009 +0200
@@ -2691,5 +2691,5 @@
   Parse_Object_Mods((ObjectPtr )Object);

-  Object->SetUp_Fractal(&sceneData->Fractal_Iteration_Stack_Length);
+  Object->SetUp_Fractal(&sceneData->Fractal_Iteration_Stack_Length,this);

   return((ObjectPtr)Object);
diff -r 562a27c89044 source/backend/shape/fractal.cpp
--- a/source/backend/shape/fractal.cpp  Mon Apr 13 14:05:24 2009 +0200
+++ b/source/backend/shape/fractal.cpp  Mon Apr 13 14:13:17 2009 +0200
@@ -105,4 +105,5 @@
 #include "backend/scene/threaddata.h"
 #include "base/pov_err.h"
+#include "backend/parser/parse.h"

 // this must be the last file included
@@ -822,5 +823,5 @@
 ******************************************************************************/

-void Fractal::SetUp_Fractal(int *MaxIterStackLength)
+void Fractal::SetUp_Fractal(int *MaxIterStackLength, Parser *caller)
 {
   switch (Algebra)
@@ -911,5 +912,9 @@

   if (Num_Iterations > *MaxIterStackLength)
+  {
     *MaxIterStackLength = Num_Iterations;
+    TraceThreadData* updated= caller->GetParserDataPtr();
+    Allocate_Iteration_Stack(updated->Fractal_IStack, Num_Iterations);
+    }

   Compute_BBox();
diff -r 562a27c89044 source/backend/shape/fractal.h
--- a/source/backend/shape/fractal.h    Mon Apr 13 14:05:24 2009 +0200
+++ b/source/backend/shape/fractal.h    Mon Apr 13 14:13:17 2009 +0200
@@ -97,4 +97,5 @@
 {

+class Parser;
 using namespace std;

@@ -186,5 +187,5 @@
                static void Allocate_Iteration_Stack(DBL **IStack, int Len);

-               void SetUp_Fractal(int *MaxIterStackLength);
+               void SetUp_Fractal(int *MaxIterStackLength, Parser *caller);
 };


Post a reply to this message

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