horsley commented on issue #12934:
URL: https://github.com/apache/apisix/issues/12934#issuecomment-3787622091

    ### Proposed fix
     Align stream init with http init:
     - call `core.env.init()` in `stream_init()`
     - call `apisix_secret.init_worker()` in `stream_init_worker()`
   
     ### Patch
     
   ```diff
   diff --git a/deps/apisix/apisix/init.lua b/deps/apisix/apisix/init.lua
   --- a/deps/apisix/apisix/init.lua
   +++ b/deps/apisix/apisix/init.lua
   @@
    function _M.stream_init(args)
        core.log.info("enter stream_init")
   
        core.resolver.init_resolver(args)
   +    core.env.init()
   
        if core.config.init then
            local ok, err = core.config.init()
            if not ok then
                core.log.error("failed to load the configuration: ", err)
            end
        end
   
        xrpc.init()
    end
   
   @@
    function _M.stream_init_worker()
        core.log.info("enter stream_init_worker")
        local seed, err = core.utils.get_seed_from_urandom()
   @@
        if core.config.init_worker then
            local ok, err = core.config.init_worker()
            if not ok then
                core.log.error("failed to init worker process of ", 
core.config.type,
                               " config center, err: ", err)
            end
        end
   
        plugin.init_worker()
        xrpc.init_worker()
   +    apisix_secret.init_worker()
        router.stream_init_worker()
        require("apisix.http.service").init_worker()
        apisix_upstream.init_worker()
   
   ———
   ```
   
   ### Verification
   
     After applying this patch on our side, stream TLS with $ENV:// cert/key 
succeeds and handshake completes normally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to