FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix: get ngx_array_t element number error by seven-eleven · Pull Request #198 · weibocom/nginx-upsync-module · GitHub

Repository navigation

Fix: get ngx_array_t element number error - #198

Closed
seven-eleven wants to merge 2 commits into
weibocom:masterfrom
seven-eleven:master
Closed

seven-eleven wants to merge 2 commits into
weibocom:masterfrom
seven-eleven:master

Conversation

Copy link
Copy Markdown
Contributor

No description provided.


ngx_http_upsync_server_t *upsync_server;

ngx_pool_t *pool; // worker common pool, can't be destroyed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

更换为pool 的优点呢?有没有一种极端的情况,内存一直被吞噬(在增删server 比较频繁的场景下),pool 内存释放是以块为单位?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

删除向pool释放的内存,还能被使用,减少向系统申请、释放内存数。
没打算提交pool的修改,因为通过首次upstream有增删控制,去replace_peers已经很好了。
主要是修复bug:

我把这个删了,再提交一个PR。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

欢迎任何可能的修改哈,探讨选取最优的;还有很多待优化的地方 :-);
@seven-eleven 谢谢

Copy link
Copy Markdown
Collaborator

Thanks! The flag_array.size → flag_array.nalloc fix in this PR is already on master. Closing the rest: peers are allocated from a pool that is never destroyed, and ngx_pfree() only frees large pool allocations, so small allocations would never be released and memory would grow with every add/delete.

gfrankliu closed this Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL