<html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 10.5pt; font-family: 'Segoe UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span><span style="font-family: Tahoma, Tahoma; line-height: normal;">unsubscribe maillist for me plz</span></div>
<div><br></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="MARGIN: 10px; FONT-FAMILY: verdana; FONT-SIZE: 10pt"><div>Runfeng.Wang@netbraintech.com</div></div></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:nginx-devel-request@nginx.org">nginx-devel-request@nginx.org</a></div><div><b>Date:</b> 2015-10-14 20:00</div><div><b>To:</b> <a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a></div><div><b>Subject:</b> nginx-devel Digest, Vol 72, Issue 10</div></div></div><div><div>Send nginx-devel mailing list submissions to</div>
<div> nginx-devel@nginx.org</div>
<div> </div>
<div>To subscribe or unsubscribe via the World Wide Web, visit</div>
<div> http://mailman.nginx.org/mailman/listinfo/nginx-devel</div>
<div>or, via email, send a message with subject or body 'help' to</div>
<div> nginx-devel-request@nginx.org</div>
<div> </div>
<div>You can reach the person managing the list at</div>
<div> nginx-devel-owner@nginx.org</div>
<div> </div>
<div>When replying, please edit your Subject line so it is more specific</div>
<div>than "Re: Contents of nginx-devel digest..."</div>
<div> </div>
<div> </div>
<div>Today's Topics:</div>
<div> </div>
<div> 1. Re: Patch for s390x support (Maxim Dounin)</div>
<div> 2. Re: Patch for s390x support (Neale Ferguson)</div>
<div> 3. Resource leak on error paths in thread pools (Bart Warmerdam)</div>
<div> 4. Error path does not close fd (Bart Warmerdam)</div>
<div> 5. Re: Resource leak on error paths in thread pools (Ruslan Ermilov)</div>
<div> </div>
<div> </div>
<div>----------------------------------------------------------------------</div>
<div> </div>
<div>Message: 1</div>
<div>Date: Tue, 13 Oct 2015 15:44:08 +0300</div>
<div>From: Maxim Dounin <mdounin@mdounin.ru></div>
<div>To: nginx-devel@nginx.org</div>
<div>Subject: Re: Patch for s390x support</div>
<div>Message-ID: <20151013124408.GY30105@mdounin.ru></div>
<div>Content-Type: text/plain; charset=utf-8</div>
<div> </div>
<div>Hello!</div>
<div> </div>
<div>On Mon, Oct 12, 2015 at 05:23:04PM +0000, Neale Ferguson wrote:</div>
<div> </div>
<div>> Hi,</div>
<div>> I would like to contribute the a fix to enable the Linux s390x platform.</div>
<div>> The fix was built against today?s mercurial master and pertains to the gcc</div>
<div>> atomic functions. I note the other architectures use inline assembler</div>
<div>> rather than the gcc builtin operations. Is this for historical reasons?</div>
<div> </div>
<div>GCC builtin atomic operations are used when available, grep </div>
<div>NGX_HAVE_GCC_ATOMIC for details.</div>
<div> </div>
<div>-- </div>
<div>Maxim Dounin</div>
<div>http://nginx.org/</div>
<div> </div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Message: 2</div>
<div>Date: Tue, 13 Oct 2015 13:22:58 +0000</div>
<div>From: Neale Ferguson <neale@sinenomine.net></div>
<div>To: "nginx-devel@nginx.org" <nginx-devel@nginx.org></div>
<div>Subject: Re: Patch for s390x support</div>
<div>Message-ID: <D2427D0B.4508C%neale@sinenomine.net></div>
<div>Content-Type: text/plain; charset="utf-7"</div>
<div> </div>
<div>Thanks. I have the non-builtin version of the atomic operations written</div>
<div>for s390x, so on the off chance if someone wants to build using gcc < 4.1</div>
<div>then things will build/run. However, given then low probability of that is</div>
<div>it worth submitting the patch?</div>
<div> </div>
<div>On 10/13/15, 8:44 AM, "nginx-devel on behalf of Maxim Dounin"</div>
<div><nginx-devel-bounces@nginx.org on behalf of mdounin@mdounin.ru> wrote:</div>
<div> </div>
<div>>Hello!</div>
<div>></div>
<div>>On Mon, Oct 12, 2015 at 05:23:04PM ?, Neale Ferguson wrote:</div>
<div>></div>
<div>>> Hi,</div>
<div>>> I would like to contribute the a fix to enable the Linux s390x platform.</div>
<div>>> The fix was built against today?s mercurial master and pertains to the</div>
<div>>>gcc</div>
<div>>> atomic functions. I note the other architectures use inline assembler</div>
<div>>> rather than the gcc builtin operations. Is this for historical reasons?</div>
<div>></div>
<div>>GCC builtin atomic operations are used when available, grep</div>
<div>>NGX_HAVE_GCC_ATOMIC for details.</div>
<div> </div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Message: 3</div>
<div>Date: Tue, 13 Oct 2015 23:21:45 +0200</div>
<div>From: Bart Warmerdam <bartw@xs4all.nl></div>
<div>To: nginx-devel@nginx.org</div>
<div>Subject: Resource leak on error paths in thread pools</div>
<div>Message-ID: <1444771305.1669.2.camel@xs4all.nl></div>
<div>Content-Type: text/plain; charset="us-ascii"</div>
<div> </div>
<div> </div>
<div>It looks like in the error paths the attr variable is not destroyed.</div>
<div>Please consider adding this patch to the source base.</div>
<div> </div>
<div>Regards,</div>
<div> </div>
<div>B.</div>
<div> </div>
<div> </div>
<div># HG changeset patch</div>
<div># User bartw@xs4all.nl</div>
<div># Date 1444770783 -7200</div>
<div># Tue Oct 13 23:13:03 2015 +0200</div>
<div># Branch thread_unrelease_attr</div>
<div># Node ID c2ae7364ec3f2251b8d734f3be7b62ea413dc36f</div>
<div># Parent 2f34ea503ac4e015cc08f6efbb279b360eda609c</div>
<div>Release attr variable on exit</div>
<div> </div>
<div>diff -r 2f34ea503ac4 -r c2ae7364ec3f src/core/ngx_thread_pool.c</div>
<div>--- a/src/core/ngx_thread_pool.c Wed Oct 07 22:19:42 2015 +0300</div>
<div>+++ b/src/core/ngx_thread_pool.c Tue Oct 13 23:13:03 2015 +0200</div>
<div>@@ -140,6 +140,7 @@</div>
<div> #if 0</div>
<div> err = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);</div>
<div> if (err) {</div>
<div>+ (void) pthread_attr_destroy(&attr);</div>
<div> ngx_log_error(NGX_LOG_ALERT, log, err,</div>
<div> "pthread_attr_setstacksize() failed");</div>
<div> return NGX_ERROR;</div>
<div>@@ -149,6 +150,7 @@</div>
<div> for (n = 0; n < tp->threads; n++) {</div>
<div> err = pthread_create(&tid, &attr, ngx_thread_pool_cycle, tp);</div>
<div> if (err) {</div>
<div>+ (void) pthread_attr_destroy(&attr);</div>
<div> ngx_log_error(NGX_LOG_ALERT, log, err,</div>
<div> "pthread_create() failed");</div>
<div> return NGX_ERROR;</div>
<div>diff -r 2f34ea503ac4 -r c2ae7364ec3f src/os/unix/ngx_thread_mutex.c</div>
<div>--- a/src/os/unix/ngx_thread_mutex.c Wed Oct 07 22:19:42 2015</div>
<div>+0300</div>
<div>+++ b/src/os/unix/ngx_thread_mutex.c Tue Oct 13 23:13:03 2015</div>
<div>+0200</div>
<div>@@ -89,6 +89,7 @@</div>
<div> </div>
<div> err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);</div>
<div> if (err != 0) {</div>
<div>+ (void) pthread_attr_destroy(&attr);</div>
<div> ngx_log_error(NGX_LOG_EMERG, log, err,</div>
<div> "pthread_mutexattr_settype"</div>
<div> "(PTHREAD_MUTEX_ERRORCHECK) failed");</div>
<div>@@ -97,6 +98,7 @@</div>
<div> </div>
<div> err = pthread_mutex_init(mtx, &attr);</div>
<div> if (err != 0) {</div>
<div>+ (void) pthread_attr_destroy(&attr);</div>
<div> ngx_log_error(NGX_LOG_EMERG, log, err,</div>
<div> "pthread_mutex_init() failed");</div>
<div> return NGX_ERROR;</div>
<div> </div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Message: 4</div>
<div>Date: Tue, 13 Oct 2015 23:58:04 +0200</div>
<div>From: Bart Warmerdam <bartw@xs4all.nl></div>
<div>To: nginx-devel@nginx.org</div>
<div>Subject: Error path does not close fd</div>
<div>Message-ID: <1444773484.19364.4.camel@xs4all.nl></div>
<div>Content-Type: text/plain; charset="iso-8859-1"</div>
<div> </div>
<div> </div>
<div> </div>
<div>Hello,</div>
<div> </div>
<div>In the ngx_daemon.c the dup2 result code is checked but the earlier</div>
<div>opened /dev/null handle is not closed in case of an error. Please</div>
<div>consider this path to add to the source base.</div>
<div> </div>
<div>Regards,</div>
<div> </div>
<div>B.</div>
<div> </div>
<div> </div>
<div># HG changeset patch</div>
<div># User Bart Warmerdam <bartw@xs4all.nl></div>
<div># Date 1444773372 -7200</div>
<div>#??????Tue Oct 13 23:56:12 2015 +0200</div>
<div># Branch close_fd_on_error</div>
<div># Node ID e1e25db76cdf7583f1145b91b9dbcdff417d6f16</div>
<div># Parent??2f34ea503ac4e015cc08f6efbb279b360eda609c</div>
<div>Close file handle on error as well</div>
<div> </div>
<div>diff -r 2f34ea503ac4 -r e1e25db76cdf src/os/unix/ngx_daemon.c</div>
<div>--- a/src/os/unix/ngx_daemon.c Wed Oct 07 22:19:42 2015 +0300</div>
<div>+++ b/src/os/unix/ngx_daemon.c Tue Oct 13 23:56:12 2015 +0200</div>
<div>@@ -9,6 +9,20 @@</div>
<div>?#include <ngx_core.h></div>
<div>?</div>
<div>?</div>
<div>+static ngx_int_t</div>
<div>+ngx_close_handle(ngx_log_t *log, int fd)</div>
<div>+{</div>
<div>+????if (fd > STDERR_FILENO) {</div>
<div>+????????if (close(fd) == -1) {</div>
<div>+????????????ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close()</div>
<div>failed");</div>
<div>+????????????return NGX_ERROR;</div>
<div>+????????}</div>
<div>+????}</div>
<div>+</div>
<div>+????return NGX_OK;</div>
<div>+}</div>
<div>+</div>
<div>+</div>
<div>?ngx_int_t</div>
<div>?ngx_daemon(ngx_log_t *log)</div>
<div>?{</div>
<div>@@ -44,26 +58,26 @@</div>
<div>?</div>
<div>?????if (dup2(fd, STDIN_FILENO) == -1) {</div>
<div>?????????ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDIN)</div>
<div>failed");</div>
<div>+????????ngx_close_handle(log, fd);</div>
<div>?????????return NGX_ERROR;</div>
<div>?????}</div>
<div>?</div>
<div>?????if (dup2(fd, STDOUT_FILENO) == -1) {</div>
<div>?????????ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDOUT)</div>
<div>failed");</div>
<div>+????????ngx_close_handle(log, fd);</div>
<div>?????????return NGX_ERROR;</div>
<div>?????}</div>
<div>?</div>
<div>?#if 0</div>
<div>?????if (dup2(fd, STDERR_FILENO) == -1) {</div>
<div>?????????ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDERR)</div>
<div>failed");</div>
<div>+????????ngx_close_handle(log, fd);</div>
<div>?????????return NGX_ERROR;</div>
<div>?????}</div>
<div>?#endif</div>
<div>?</div>
<div>-????if (fd > STDERR_FILENO) {</div>
<div>-????????if (close(fd) == -1) {</div>
<div>-????????????ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close()</div>
<div>failed");</div>
<div>-????????????return NGX_ERROR;</div>
<div>-????????}</div>
<div>+????if (ngx_close_handle(log, fd) == NGX_ERROR) {</div>
<div>+????????return NGX_ERROR;</div>
<div>?????}</div>
<div>?</div>
<div>?????return NGX_OK;</div>
<div>-------------- next part --------------</div>
<div>An HTML attachment was scrubbed...</div>
<div>URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20151013/26bee341/attachment-0001.html></div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Message: 5</div>
<div>Date: Wed, 14 Oct 2015 13:38:18 +0300</div>
<div>From: Ruslan Ermilov <ru@nginx.com></div>
<div>To: nginx-devel@nginx.org</div>
<div>Subject: Re: Resource leak on error paths in thread pools</div>
<div>Message-ID: <20151014103818.GA75964@lo0.su></div>
<div>Content-Type: text/plain; charset=us-ascii</div>
<div> </div>
<div>On Tue, Oct 13, 2015 at 11:21:45PM +0200, Bart Warmerdam wrote:</div>
<div>> It looks like in the error paths the attr variable is not destroyed.</div>
<div>> Please consider adding this patch to the source base.</div>
<div> </div>
<div>No thanks (please see below).</div>
<div> </div>
<div>> # HG changeset patch</div>
<div>> # User bartw@xs4all.nl</div>
<div>> # Date 1444770783 -7200</div>
<div>> # Tue Oct 13 23:13:03 2015 +0200</div>
<div>> # Branch thread_unrelease_attr</div>
<div>> # Node ID c2ae7364ec3f2251b8d734f3be7b62ea413dc36f</div>
<div>> # Parent 2f34ea503ac4e015cc08f6efbb279b360eda609c</div>
<div>> Release attr variable on exit</div>
<div>> </div>
<div>> diff -r 2f34ea503ac4 -r c2ae7364ec3f src/core/ngx_thread_pool.c</div>
<div>> --- a/src/core/ngx_thread_pool.c Wed Oct 07 22:19:42 2015 +0300</div>
<div>> +++ b/src/core/ngx_thread_pool.c Tue Oct 13 23:13:03 2015 +0200</div>
<div>> @@ -140,6 +140,7 @@</div>
<div>> #if 0</div>
<div>> err = pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);</div>
<div>> if (err) {</div>
<div>> + (void) pthread_attr_destroy(&attr);</div>
<div>> ngx_log_error(NGX_LOG_ALERT, log, err,</div>
<div>> "pthread_attr_setstacksize() failed");</div>
<div>> return NGX_ERROR;</div>
<div>> @@ -149,6 +150,7 @@</div>
<div>> for (n = 0; n < tp->threads; n++) {</div>
<div>> err = pthread_create(&tid, &attr, ngx_thread_pool_cycle, tp);</div>
<div>> if (err) {</div>
<div>> + (void) pthread_attr_destroy(&attr);</div>
<div>> ngx_log_error(NGX_LOG_ALERT, log, err,</div>
<div>> "pthread_create() failed");</div>
<div>> return NGX_ERROR;</div>
<div> </div>
<div>There's no leak here because if ngx_thread_pool_init() fails, the</div>
<div>worker process will exit with an error, effectively releasing all</div>
<div>resources.</div>
<div> </div>
<div>We similarly don't care about destroying successfully created</div>
<div>threads if we fail creating the next thread.</div>
<div> </div>
<div>> diff -r 2f34ea503ac4 -r c2ae7364ec3f src/os/unix/ngx_thread_mutex.c</div>
<div>> --- a/src/os/unix/ngx_thread_mutex.c Wed Oct 07 22:19:42 2015</div>
<div>> +0300</div>
<div>> +++ b/src/os/unix/ngx_thread_mutex.c Tue Oct 13 23:13:03 2015</div>
<div>> +0200</div>
<div>> @@ -89,6 +89,7 @@</div>
<div>> </div>
<div>> err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);</div>
<div>> if (err != 0) {</div>
<div>> + (void) pthread_attr_destroy(&attr);</div>
<div>> ngx_log_error(NGX_LOG_EMERG, log, err,</div>
<div>> "pthread_mutexattr_settype"</div>
<div>> "(PTHREAD_MUTEX_ERRORCHECK) failed");</div>
<div>> @@ -97,6 +98,7 @@</div>
<div>> </div>
<div>> err = pthread_mutex_init(mtx, &attr);</div>
<div>> if (err != 0) {</div>
<div>> + (void) pthread_attr_destroy(&attr);</div>
<div>> ngx_log_error(NGX_LOG_EMERG, log, err,</div>
<div>> "pthread_mutex_init() failed");</div>
<div>> return NGX_ERROR;</div>
<div> </div>
<div>Ditto, but you also misspelled pthread_mutexattr_destroy()</div>
<div>as pthread_attr_destroy().</div>
<div> </div>
<div> </div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>Subject: Digest Footer</div>
<div> </div>
<div>_______________________________________________</div>
<div>nginx-devel mailing list</div>
<div>nginx-devel@nginx.org</div>
<div>http://mailman.nginx.org/mailman/listinfo/nginx-devel</div>
<div> </div>
<div>------------------------------</div>
<div> </div>
<div>End of nginx-devel Digest, Vol 72, Issue 10</div>
<div>*******************************************</div>
</div></blockquote>
</body></html>