To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=105919
                 Issue #|105919
                 Summary|pyuno: unsafe thread accesses after exit
               Component|udk
                 Version|DEV300m61
                Platform|All
                     URL|
              OS/Version|Linux
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|PATCH
                Priority|P3
            Subcomponent|code
             Assigned to|jbu
             Reported by|cmc





------- Additional comments from [email protected] Thu Oct 15 09:01:09 +0000 
2009 -------
Some times when I run dmake runtest in testtools/source/bridgetest/pyuno I get a
crash after exit. Digging into it with valgrind and with Python compiled to be
valgrind friendly I get...

==1941== Thread 3:
==1941== Invalid read of size 8
==1941==    at 0x4F2B46F: PyThreadState_New (pystate.c:201)
==1941==    by 0xBE14200: pyuno::PyThreadAttach::PyThreadAttach(_is*)
(pyuno_runtime.cxx:1004)
==1941==    by 0xBE2D2F8: pyuno::GCThread::run() (pyuno_gc.cxx:78)
==1941==    by 0xBE2D659: threadFunc (thread.hxx:187)
==1941==    by 0xC53A4BB: ??? (in 
/OOO/solver/300/unxlngx6.pro/lib/libuno_sal.so.3)
==1941==    by 0x51E7969: start_thread (pthread_create.c:297)
==1941==  Address 0x5e09048 is 8 bytes inside a block of size 80 free'd
==1941==    at 0x4C25A72: free (vg_replace_malloc.c:325)
==1941==    by 0x4F2CCDD: Py_Finalize (pythonrun.c:489)
==1941==    by 0x4F39B81: Py_Main (main.c:623)
==1941==    by 0x5AA7B4C: (below main) (libc-start.c:220)

The code is currently protected with a
g_destructorsOfStaticObjectsHaveBeenCalled which is set in a global object dtor
to detect module unload/program exit. That alleviates the symptoms but isn't
sufficient as there's a window between PyFinalize getting called and program
exit where the thread can run and access memory deleted by Py_Finalize.

I can't see any (working) python callback that's triggered during Py_Finalize
that could be used to do this erally properly. Attached is a patch to
additinally check Py_IsInitialized which at least gets toggled to 0 by
Py_Finalize when its entered. That worksaround the problem for me. 

cmc->jbu: Happy with this patch ?, if so I can commit in to one of my 
workspaces.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to