[ 
https://issues.apache.org/jira/browse/TUSCANY-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caroline Maynard updated TUSCANY-1147:
--------------------------------------

    Attachment: SDOAPITest.php

Here's an extremely stripped-down version of the test in question. It's just a 
company with one employee, who is the EOTM (not much competition there).  The 
references are not dropped explicitly in the php source. Therefore what happens 
is that when the function ends and the variables go out of scope, the php 
runtime releases them. FIrst it (successfully) frees the company. Then it tries 
to free the employee, which crashes like so:

commonj::sdo::DataObjectImpl::clearReferences() line 3410 + 58 bytes
commonj::sdo::DataObjectImpl::~DataObjectImpl() line 3270
commonj::sdo::DataObjectImpl::`scalar deleting destructor'(unsigned int 
0x00000001) + 37 bytes
commonj::sdo::RefCountingObject::releaseRef() line 71 + 56 bytes
commonj::sdo::RefCountingPointer<commonj::sdo::DataObject>::operator=(const 
commonj::sdo::RefCountingPointer<commonj::sdo::DataObject> & {...}) line 148
sdo_do_object_free_storage(void * 0x020e81f0, void * * * 0x003d29b8) line 98 + 
32 bytes

the failing line being the the one starting refs[i]->getDataObject below:
void DataObjectImpl::clearReferences()
    {
        for (unsigned int i=0;i<refs.size();i++)
        {
            // Note - no loop as the referer must be of type reference
            refs[i]->getDataObject()->unset(refs[i]->getProperty());
            delete refs[i];
        }
        refs.clear();
    }

What my fix does is to make sure that when company->EOTM is unset, that the 
reference is cleared at that time, and it does eliminate the crash.

(Note that if the DOs are destroyed in the right order, that is, if I 
explicitly drop the $ron reference within the function, so that only the 
company is left to be freed by the php runtime later, the problem does not 
occur. But that's not what real users do ...)

> AccessViolation in DataObjectImpl::clearReferences()
> ----------------------------------------------------
>
>                 Key: TUSCANY-1147
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1147
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-current
>         Environment: Win32, PHP 5.2.1
>            Reporter: Caroline Maynard
>            Priority: Critical
>         Attachments: SDOAPITest.php, Tuscany-1147.patch, Tuscany-1147.patch
>
>
> Problem observed when SDO A refers to SDO B.  The reference to SDO A is 
> dropped. Then the reference to SDO B is dropped. An AccessViolation occurs in 
> the SDODataObject destructor, in DataObjectImpl::clearReferences().
> I believe this is because the reference was not properly cleared at the time 
> of A's destruction. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to