apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Collins-Sussman <suss...@collab.net>
Subject Re: apr_generate_random_bytes() blocks forever
Date Wed, 16 Apr 2003 15:55:23 GMT
Ben Laurie <ben@algroup.co.uk> writes:

> Ben Collins-Sussman wrote:
> > He did give a very detailed overview of his proposed API, if you go
> > back read his original response.  The problem is that I haven't the
> > first idea of how to start implementing it.  And his API seems to
> Well, I'll worry about how to implement it, but...
> > focus on passing parameters that tweak the quality of the randomness,
> > but for Subversion, what really matters in the non-blocking aspect.
> I'd really like to understand this - if you really don't care about
> quality of randomness, why aren't you using rand()? Or a fixed number?
> What is the randomness used for?

Allow me to foist Subversion's design issues on the APR folks.  :-)
Maybe the great minds here can suggest a good solution to our problem.

Here's our situation.  

*  svn_repos_create() needs to generate a UUID that identifies the
   newly created repository.  This UUID becomes a permanent identifier
   for the repository... so it calls apr_uuid_get().

*  apr_uuid_get() calls apr_generate_random_bytes().

*  apr_generate_random_bytes() can potentially block for entropy when
   reading /dev/random.  

   And in practice, this *has* been biting a few svn users, including
   me.  When I run 'make check' (which creates a new repository for
   each test), and go to bed for the night, we discover only a few
   tests have run, because there was no system entropy.  As soon as I
   start typing, the tests start running again.

   [side note:  yes, I'm aware that FreeBSD 4.X (my system) has a
    poor /dev/random implementation, and I'm aware that FreeBSD 5.X no
    longer suffers this problem.  But I've also seen the problem
    happen on flaky RedHat boxes as well.]

So perhaps svn_repos_create() shouldn't be calling apr_uuid_get() at
all?  Perhaps svn should have its own pseudorandom-nonblocking uuid
generator?  Perhaps APR could grow one?

View raw message