RE: [PHP-CVS] com php-src: don't keep locked mutex after errors: ext/opcache/ZendAccelerator.c

From: Date: Fri, 25 Sep 2015 05:21:25 +0000
Subject: RE: [PHP-CVS] com php-src: don't keep locked mutex after errors: ext/opcache/ZendAccelerator.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89171@lists.php.net to get a copy of this message
Hi Yasuo, > -----Original Message----- > From: yohgaki@gmail.com [mailto:yohgaki@gmail.com] On Behalf Of Yasuo > Ohgaki > Sent: Friday, September 25, 2015 4:48 AM > To: Anatol Belski <ab@php.net> > Cc: php-cvs@lists.php.net > Subject: Re: [PHP-CVS] com php-src: don't keep locked mutex after errors: > ext/opcache/ZendAccelerator.c > > Hi Anatol, > > I'm not sure the consequence of zend_accel_error(), but isn't safer releasing lock > before zend_accel_error()? > i.e. > > + zend_shared_alloc_unlock(); > zend_accel_error(ACCEL_LOG_FATAL, > ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned strings"); > Thanks for the check. Usually it's better to have unlock straight before return. Here it is probably even safer, because zend_accel_error() could possibly open/close error log file (though in append mode). Regards Anatol > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > > On Thu, Sep 24, 2015 at 11:34 PM, Anatol Belski <ab@php.net> wrote: > > Commit: 0fd7acd11d4a8cdb6afafabd9eb7eef8385cd067 > > Author: Anatol Belski <ab@php.net> Thu, 24 Sep 2015 14:41:08 +0200 > > Parents: df832c966ce5c09a1c7dd557ebfb80f1dc181f4f > > Branches: PHP-7.0 master > > > > Link: http://git.php.net/?p=php- > src.git;a=commitdiff;h=0fd7acd11d4a8cdb6afafabd9eb7eef8385cd067 > > > > Log: > > don't keep locked mutex after errors > > > > Changed paths: > > M ext/opcache/ZendAccelerator.c > > > > > > Diff: > > diff --git a/ext/opcache/ZendAccelerator.c > > b/ext/opcache/ZendAccelerator.c index c09b08d..3fa015e 100644 > > --- a/ext/opcache/ZendAccelerator.c > > +++ b/ext/opcache/ZendAccelerator.c > > @@ -2366,6 +2366,7 @@ static int zend_accel_init_shm(void) > > accel_shared_globals = > zend_shared_alloc(sizeof(zend_accel_shared_globals)); > > if (!accel_shared_globals) { > > zend_accel_error(ACCEL_LOG_FATAL, "Insufficient shared > > memory!"); > > + zend_shared_alloc_unlock(); > > return FAILURE; > > } > > ZSMMG(app_shared_globals) = accel_shared_globals; @@ -2383,6 > > +2384,7 @@ static int zend_accel_init_shm(void) > > ZCSG(interned_strings_start) = > zend_shared_alloc((ZCG(accel_directives).interned_strings_buffer * 1024 * > 1024)); > > if (!data || !ZCSG(interned_strings_start)) { > > zend_accel_error(ACCEL_LOG_FATAL, > > ACCELERATOR_PRODUCT_NAME " cannot allocate buffer for interned > > strings"); > > + zend_shared_alloc_unlock(); > > return FAILURE; > > } > > HT_SET_DATA_ADDR(&ZCSG(interned_strings), data); > > > > > > -- > > PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: > > http://www.php.net/unsub.php > >

« previous php.cvs (#89171) next »