<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Joshua,<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 23 Aug 2024, at 1:48 PM, Joshua O'Sullivan <joshua@firetail.io> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr">Hey everyone,<div><br></div><div>We're currently developing a dynamic module which itself loads another shared library, which we've written in Golang. It seems to be a bit off the beaten track - I can't find any guidance in the documentation pertaining to loading shared libraries in dynamic modules, and there's only one example in the wild I can find of this being attempted before - <a href="https://github.com/robinmonjo/ngx_http_l?tab=readme-ov-file#issues-encountered" target="_blank">https://github.com/robinmonjo/ngx_http_l?tab=readme-ov-file#issues-encountered</a>.</div><div><br></div><div>We've got a proof-of-concept, however we're struggling with where to store the shared library - keeping it in the main configuration seems to make sense, but calls to `dlopen` in our create or init main configuration functions seem to cause NGINX to hang when it handles requests. We're currently using version 1.24.0.</div></div></div></blockquote><br></div><div>Indeed you can load a shared library in create_conf or init_conf and store its handle in the configuration. Also you need to register a cycle pool cleanup handler which would release the library.</div><div><br></div><div>Could you please provide a stack trace of nginx when it hangs?</div><br><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>----</div><div>Roman Arutyunyan</div><div>arut@nginx.com</div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">

</div>
<br></body></html>