Guidance developing dynamic modules which load shared libraries

Roman Arutyunyan arut at nginx.com
Mon Aug 26 11:35:03 UTC 2024


Hi Joshua,

> On 23 Aug 2024, at 1:48 PM, Joshua O'Sullivan <joshua at firetail.io> wrote:
> 
> Hey everyone,
> 
> 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 - https://github.com/robinmonjo/ngx_http_l?tab=readme-ov-file#issues-encountered.
> 
> 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.

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.

Could you please provide a stack trace of nginx when it hangs?

----
Roman Arutyunyan
arut at nginx.com




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20240826/e0b52347/attachment.htm>


More information about the nginx-devel mailing list