<div dir="ltr">Hello Robert,<div><br></div><div>My impression is that the cyclic memory buffer is not shared across workers. The memory is allocated using ngx_pnalloc and that is not the shared memory zone. After fork each worker would have their own buffer instead.</div><div><br></div><div>Which probably explains why this is only suitable for debugging, as you have to know the worker you are trying to debug in order to access the logs this way.</div><div><br></div><div>Thanks,</div><div>Datong</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 3, 2020 at 8:00 PM Robert Paprocki <<a href="mailto:rpaprocki@fearnothingproductions.net">rpaprocki@fearnothingproductions.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hello,<div><br></div><div><a href="http://nginx.org/en/docs/debugging_log.html" target="_blank">http://nginx.org/en/docs/debugging_log.html</a> and associated literature instruct to dump the contents of a “memory” error_log target via gdb memory dump. How is it possible to do this for a given nginx worker process, when other worker processes are serving connections simultaneously and generating error logs to the shared memory zone (at least, I’m assuming it’s shared by all workers, since it’s allocated from the conf pool during configuration parsing). Is it possible other workers are memcpy() with a dst pointing to the buffer where a simultaneous gdb memory dump is executing? Wouldn’t this potentially cause corruption of the read data?</div><div><br></div><div>The origin of my question was hacking on a routine that would dump the memory buffer to a file from within nginx directly, rather than probing into the process with gdb- at first it looks trivial to just write() the whole buffer, but since there’s no synchronization mechanism, I anticipate this would cause problems in a busy environment. </div><div><br><div dir="ltr">Sent from my iPhone</div></div></div>_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><table width="600" cellspacing="0" cellpadding="0" border="0" style="color:rgb(0,0,0);padding:32px 0px;font-size:13px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><tbody><tr><td width="44" style="vertical-align:top;padding:0px 16px"><a href="https://konghq.com/" target="_blank"><img width="100%" src="https://konghq.com/wp-content/uploads/2018/01/kogo-color.png" style="border: none;"></a></td><td width="16" style="border-left:1px solid rgb(212,212,212)"></td><td style="vertical-align:top"><span style="display:block;padding-top:10px;line-height:0px;font-size:15px;font-weight:bold">Datong Sun</span><br><span style="margin-bottom:16px;color:rgb(76,76,76)">Systems Engineer @ <a href="http://konghq.com/" style="color:rgb(23,169,86)" target="_blank">Kong</a></span> <br><br><font color="#999999">150 Spear Street, Suite 1600<br style="font-family:-apple-system,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol""><span style="font-family:-apple-system,system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"">San Francisco, CA 94105</span><br></font><br><table cellpadding="0" border="0" style="vertical-align:top"><tbody><tr></tr></tbody></table><br></td></tr></tbody></table></div></div></div></div></div></div>