Menu

#4 Memory freeing problem when using multiple threads

open
nobody
None
5
2008-07-25
2008-07-25
No

Am calling pcFrameBegin/AddFramelet/End from one thread (a render thread) and retrieving final image with pcFrameResultChannel/pcResultGetChannelHP in another thread (a display thread on the master node). A locking scheme is used to ensure calls to pc functions are serialized. This is causing free() to be given bad pointers in

core.cpp, line 290, Core::StartFrame()
...
if(*iter2)
free(*iter2);

and

pcontext.cpp, line 1689, Context::FrameBegin()
...
if (*iter2)
free(*iter2);

Further tests have shown that calling pcFrameResultChannel() (and other pc calls) all in one thread result in bad free-ing only on window resizes. In this case framelets are fullscreen. The call sequence is as follows (node 0 is master, 1 and 2 are render nodes. free() call has been replaced with a print of the pointer):

0: pcFrameBegin(no framelets, _frameId 206 )
Context::FrameBegin Not freeing iter2 0x2aaaadf16010
Core::StartFrame Not freeing iter2 0x2aaaade0d010

1: pcFrameBegin(1 framelet, _frameId 206 )
Core::StartFrame Not freeing iter2 0x2aaaac423010
Core::StartFrame Not freeing iter2 0xbded40

2: pcFrameBegin(1 framelet, _frameId 206 )
Core::StartFrame Not freeing iter2 0x2aaaac607010
Core::StartFrame Not freeing iter2 0xa114b0

FrameEnds not printed

0: pcFrameResultChannel(_frameId 206 )

Am investigating sync of window sizes and possible memory stomping.

George

Discussion

  • George Leaver

    George Leaver - 2008-08-04

    Logged In: YES
    user_id=933672
    Originator: YES

    Follow-up:

    It looks as though this is not a multi-thread issue. Our problem is caused by the use of the Align() function in misc.cpp (line 49). The modified pointer is causing problems on the SVA and a non-HP linux box (64bit running Ubuntu). Note all pointers coming in to Align() are realligned but those that are cause problems, the most serious being that on the HP SVA the code in paracomp to handle the VAPI interconnect crashes with the following message:

    [0] Exception thrown in processIBCompletionsThread: IB Network -- Error: completion error detected on CQ:VAPI_LOC_ACCS_ERR

    On the linux_64 box we see invalid pointer messages if MALLOC_CHECK_=1 is set in the environment.

    When running the paracomp samples we do not see these errors. Modifying Align() so that it simply returns the unmodified pointer fixes the problems.

    Note, we are running as an MPI application (HP MPI on the SVA, mpich2 on the linux box).

    George

     
  • George Leaver

    George Leaver - 2008-08-04

    Logged In: YES
    user_id=933672
    Originator: YES

    The line

    Note all pointers coming in to Align()...

    should read

    Not all pointers coming in to Align()...

     

Log in to post a comment.