ASF subversion and git services commented on PROTON-489:

Commit 1570659 from [~kgiusti] in branch 'proton/trunk'
[ https://svn.apache.org/r1570659 ]

PROTON-489: Use reference counting for object management.

Each child object will keep a reference to its parent: Deliveries
reference Links, which reference their Sessions, which reference the
containing Connection.  This keeps the parent objects present until
all child objects have been released.

The transport work lists also reference count their members (Endpoints
and Deliveries).  This keeps freed objects around long enough to flush
their pending state prior to deleting them.

> [proton-c] Segfault when freeing endpoints out-of-order.
> --------------------------------------------------------
>                 Key: PROTON-489
>                 URL: https://issues.apache.org/jira/browse/PROTON-489
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: 0.6
>            Reporter: Ken Giusti
>            Assignee: Ken Giusti
> If a connection or session is freed before all of its "children" objects 
> (sessions, links) are freed, a segFault is hit.
> Example code that triggers this:
> #include "proton/engine.h"
> int main(int argc, char** argv)
> {
>     pn_connection_t *conn = pn_connection();
>     pn_session_t *ssn = pn_session(conn);
>     pn_link_t *tx = pn_sender(ssn, "tx");
>     pn_link_t *rx = pn_sender(ssn, "tx");
>     pn_connection_free(conn);
>     pn_session_free(ssn);
>     pn_link_free(tx);
>     pn_link_free(rx);
>     return 0;
> }
> While releasing endpoints in this order may not be considered correct, we 
> should prevent segfaulting when the program accesses a "orphaned" endpoint.

This message was sent by Atlassian JIRA

Reply via email to