You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2015/07/20 00:16:57 UTC

[Bug 58152] New: apr_pool_create returns the same pool (pointer) after multiple invocations with allocator = NULL

https://bz.apache.org/bugzilla/show_bug.cgi?id=58152

            Bug ID: 58152
           Summary: apr_pool_create returns the same pool (pointer) after
                    multiple invocations with allocator = NULL
           Product: APR
           Version: 1.5.2
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: jared.breeden@gmail.com

Calling `apr_pool_create_ex` with no abort_fn or allocator (as is the case with
the `apr_pool_create(**pool, *parent)` macro) begins to return the same pool
over and over. In my current program, it happens on the third invocation each
time, and then sporadically from then on. It happens the same whether I pass in
a parent pool or not.

Obviously this creates a problem, as when I later attempt to destroy a pool
that I *think* only contains a certain set of objects, I'm actually destroying
many more.

In the output below, I'm logging all pool creations and destructions.

```
Created pool: 0x7f98f282ea28
Created pool: 0x7f98f283b628
Created pool: 0x7f98f306bc28 < These are the same
Created pool: 0x7f98f306bc28 < These are the same
Created pool: 0x7f98f3803028
...
Destroying pool: 0x7f98f306bc28 < These should be freeing...
Destroying pool: 0x7f98f306bc28 < independent sets of objects...
Destroying pool: 0x7f98f3805028
Destroying pool: 0x7f98f3803028
Destroying pool: 0x7f98f306bc28 < but they are trampling each other...
Destroying pool: 0x7f98f306bc28 < instead.
```

Note this is a single threaded application. Each call is made like this:

```
apr_initialize();
...
apr_pool_t* native_pool = NULL;
apr_pool_create_ex(&native_pool, NULL, NULL, NULL);
```

If I create a new allocator for each pool, then all is well.

Is this expected behavior? I'm guessing `apr_pool_create` should always return
a new pool.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org