Hi again,
After some searching on Nginx source code, eventually i did find out the issue. The issue was on module type. I had defined it as NGX_STREAM_MODULE, but it must be NGX_HTTP_MODULE because i did intend to add some features to upstream module. Also I had to change configuration directive from NGX_STREAM_SRV_CONF|NGX_CONF_NOARGS to NGX_HTTP_UPS_CONF|NGX_CONF_NOARGS. Type of ngx_*_ctx was not correct and it was changed to ngx_http_module_t .
Sincerely,
Nima