You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Balazs Mezodi <am...@bonus.hu> on 2003/09/02 10:30:41 UTC

apr_reslist question

hi,


  i'm new to apr, so i don't know if i ask this question at the right
place...

  i'm using the apr which is bundled with apache-2.0.47.

  how to use apr_reslist with sockets correctly? sockets are "fragile",
therefore error handling is very important:

  in apr-util/misc/apr_reslist.c the function
apr_reslist_acquire() completly ignores the return value of
create_resource() at line 370. this means that:
- the user has to find other ways to get informed about the possible
  errors occured in the reslist->constructor callback
- the reslist stores the resource as if the acquisition were successful.

  i think this is not consistent with the behaviour of
reslist_maint(), which breaks if the resource acquisition was not
successful. this might be confusing since apr_reslist_acquire() always
returns success, but apr_reslist_release() might break because of
unsuccessful resource acquisition!

  in apr/tables/apr_tables.c in apr_table_elts() at line 409 there should
be:
    return (const apr_array_header_t *)&t->a;

  the current code is working only because the member 'a' is the first one
in the structure. this might break in the future. well, at least it
deserves a short comment i think...


--
Balazs Mezodi
amebay@yahoo.com


Re: [PATCH] apr_reslist - check return value of create_resource

Posted by Cliff Woolley <jw...@virginia.edu>.
On Wed, 17 Sep 2003, Paul Querna wrote:

> Balazs Mezodi mentioned this problem more than a week ago (
> http://marc.theaimsgroup.com/?l=apr-dev&m=106249161123522&w=2 ), but it hasn't
> been fixed.
>
> Its a trivial fix to check the return code of create_resource in
> reslist_acquire, but here is a patch in the hope that someone will pick
> it up.

Committed to both branches.

--Cliff

[PATCH] apr_reslist - check return value of create_resource

Posted by Paul Querna <ch...@force-elite.com>.
Balazs Mezodi mentioned this problem more than a week ago (
http://marc.theaimsgroup.com/?l=apr-dev&m=106249161123522&w=2 ), but it hasn't
been fixed.  

Its a trivial fix to check the return code of create_resource in
reslist_acquire, but here is a patch in the hope that someone will pick it up.

-Paul Querna

Re: apr_reslist question

Posted by Cliff Woolley <jw...@virginia.edu>.
On Tue, 2 Sep 2003, Balazs Mezodi wrote:

>   i'm new to apr, so i don't know if i ask this question at the right
> place...

Indeed it is.

>   how to use apr_reslist with sockets correctly? sockets are "fragile",
> therefore error handling is very important:

Hah, that's a good question.  As far as I can tell, we don't even actually
use the apr_reslist code for anything, and it hasn't been touched in the
year since Aaron first committed it, so if it's broken chances are
nobody's noticed.

Aaron?  I'm gonna let you take this one.  :)

--Cliff