Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dso module #24

Closed
wants to merge 44 commits into from
Closed

add dso module #24

wants to merge 44 commits into from

Conversation

monadbobo
Copy link
Member

add dso module

|| (path->len == old_dl_m[i].path.len
&& ngx_strncmp(path->data, old_dl_m[i].path.data, old_dl_m[i].path.len) == 0))
{
return NGX_DECLINED;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果更改了动态模块的代码, 期望通过reload来生效, 这里是否会导致总是使用旧的代码?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是有意这么做的,如果更换了so文件,那么需要重启nginx。
原因是这样子的:
reload的时候,我无法卸载老的已经加载的dso模块,因为linux下dloepn打开都是有引用计数的。而不卸载老的加载的模块,就无法强制加载新的dso模块。
不过我确实应该文档里面注明的,明天我会修改下文档。
谢谢!

@zls0424
Copy link
Contributor

zls0424 commented Jul 24, 2012

看了一下 diff 有几点疑问, 不知是否存在 ~

  1. 如果升级了 dso module 的代码, 能否通过 reload 来使新的 module 生效 (加载新的module) ?
  2. 如果想禁用某 dso module, 在配置里注掉 dso_load, reload 能否得到期望效果?
  3. dso module 直接加载到全局的 ngx_modules 是有风险的, 如果新增加了dso_load 然后 reload 失败, ngx_modules 本身会被污染, 其他module的ctx_index等也可能会被改写, 之后如果有worker core了, master fork 出新的 worker, 取各 module conf 的时候可能是错的

@monadbobo
Copy link
Member Author

1 如果更改了so,那么需要重启nginx才能生效。
2 这个也可以得到期望效果。
3 我们不支持so变化后的reload,因此这个不会成为问题。

谢谢。

}
} else {
if (dcf->path.data[0] != '/') {
return NGX_ERROR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在解析 dso_path 命令的时候没有要求必须是绝对路径, 这里缺少提示信息, -t fail 后用户不知道什么情况

@zls0424
Copy link
Contributor

zls0424 commented Jul 25, 2012

  1. 感觉这样比较伤
  2. 这版代码里没看到相关的操作
  3. 这个不是指 dso 变化后的 reload, 比如新增了一条 dso 指令, 想 reload 生效的时候因为其他地方配置(比如某个跟 dso 无关的指令), 写错了导致失败了, 就会有这种情况

diaoliang and others added 2 commits July 27, 2012 17:19
@monadbobo
Copy link
Member Author

1 不支持reload加载修改的dso模块原因是这样子的, 如果你要重新加载新的dso,那么你必须dlclose老的handle,而如果你dlclose老的handle的话,当新的so加载失败的时候,此时就回不去原来的状态了。

2 剩下的两个问题,我这个新版本已经解决了。

谢谢!


if (cycle != ngx_cycle) {

if (cycle->old_cycle->conf_ctx) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是清理 cycle ?

static char *
ngx_dso_stub(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_str_t *value, *module_name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module_name -> module

if [ $NGX_DSO != YES ]; then
cat << END

you should enable the dso module, if you want to use a dynamic loaded module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dynamic -> dynamically

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should enable dso, if you ...

HTTP_STUB_STATUS=NO
HTTP_STUB_STATUS=YES

#shared module
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shared modules

@yaoweibin
Copy link
Member

It looks good to me.

1 similar comment
@zhuzhaoyuan
Copy link
Member

It looks good to me.

@monadbobo
Copy link
Member Author

will commit a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants