更新共享库,无需重新启动过程 [英] Update shared libraries without restarting processes

查看:367
本文介绍了更新共享库,无需重新启动过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的进程加载.so库,如果库的新版本可用,才有可能切换到新库没有做一个进程重新启动?或者,答案取决于之类的东西是否有参数变化在图书馆现有的功能之一?

If my process is loading a .so library and if a new version of the library is available is it possible to switch to the new library without doing a process restart ? Or the answer depends on things like whether there is a parameter change to one of the existing functions in the library ?

我在它运行的过程100S和图书馆的每10秒加载一个pretty大系统工作。该库提供特定的功能和不同的团队提供。所以,当图书馆的变化之一(一个bug修复可以说)理想的事情是将它发布在引擎罩,而不影响正在运行的进程。这可能吗?

I am working in a pretty big system which runs 100s of processes and each loading 10s of libraries. The libraries provide specific functionality and are provided by separate teams. So when one of the library changes (for a bug fix lets say) ideal thing would be to publish it under-the-hood without impacting the running process. Is it possible ?

修改感谢!在我的情况下,当一个新的库可所有正在运行的进程必须开始使用它。它不是选项,让他们与老版本上运行,后来接了新的。所以看起来更安全的选择是刚刚重装的过程。

EDIT Thanks! In my case when a new library is available all the running processes have to start using it. Its not option to let them run with the old version and pick-up the new one later. So it looks like the safer option is to just reload the processes.

推荐答案

您不能与运行的进程动态升级链接库。
你甚至可以尝试,但如果你赢得成功(你会不会失败了的文本文件正在使用错误消息),你必须重新启动该进程,使其映射新的库到内存中。

You cannot upgrade a linked library on the fly with a process running. You could even try to, but if you succed (and you'll not fail with a "text file is in use" error message), you'll have to restart the process to make it mapping the new library into memory.

您可以使用lsof的命令检查哪些库中(运行时或linktime)链接:

You can use lsof command to check which libraries are linked in (runtime or linktime):

lsof -p <process_pid> | grep ' mem '

这篇关于更新共享库,无需重新启动过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆