Skip to content

Commit

Permalink
fix(wasm): disable Lua DNS resolver for proxy-wasm
Browse files Browse the repository at this point in the history
We need to disable this for the time being, as coroutine scheduling
issues in the Wasm/Lua bridge are addressed in ngx_wasmx_module.
  • Loading branch information
hishamhm authored and locao committed Apr 23, 2024
1 parent b8891eb commit 294fffd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: |
Disable usage of the Lua DNS resolver from proxy-wasm by default.
type: bugfix
scope: Configuration
3 changes: 2 additions & 1 deletion kong/conf_loader/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ local function load(path, custom_conf, opts)
-- set it as such in kong_defaults, because it can only be used if wasm is
-- _also_ enabled. We inject it here if the user has not opted to set it
-- themselves.
add_wasm_directive("nginx_http_proxy_wasm_lua_resolver", "on")
-- TODO: as a temporary compatibility fix, we are forcing it to 'off'.
add_wasm_directive("nginx_http_proxy_wasm_lua_resolver", "off")

-- wasm vm properties are inherited from previously set directives
if conf.lua_ssl_trusted_certificate and #conf.lua_ssl_trusted_certificate >= 1 then
Expand Down
15 changes: 11 additions & 4 deletions spec/01-unit/04-prefix_handler_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -927,25 +927,32 @@ describe("NGINX conf compiler", function()
end)
it("injects default configurations if wasm=on", function()
assert.matches(
".+proxy_wasm_lua_resolver on;.+",
".+proxy_wasm_lua_resolver off;.+",
kong_ngx_cfg({ wasm = true, }, debug)
)
end)
it("does not inject default configurations if wasm=off", function()
assert.not_matches(
".+proxy_wasm_lua_resolver on;.+",
".+proxy_wasm_lua_resolver.+",
kong_ngx_cfg({ wasm = false, }, debug)
)
end)
it("permits overriding proxy_wasm_lua_resolver", function()
it("permits overriding proxy_wasm_lua_resolver to off", function()
assert.matches(
".+proxy_wasm_lua_resolver off;.+",
kong_ngx_cfg({ wasm = true,
-- or should this be `false`? IDK
nginx_http_proxy_wasm_lua_resolver = "off",
}, debug)
)
end)
it("permits overriding proxy_wasm_lua_resolver to on", function()
assert.matches(
".+proxy_wasm_lua_resolver on;.+",
kong_ngx_cfg({ wasm = true,
nginx_http_proxy_wasm_lua_resolver = "on",
}, debug)
)
end)
it("injects runtime-specific directives (wasmtime)", function()
assert.matches(
"wasm {.+wasmtime {.+flag flag1 on;.+flag flag2 1m;.+}.+",
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/20-wasm/04-proxy-wasm_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ describe("proxy-wasm filters (#wasm) (#" .. strategy .. ")", function()
assert.logfile().has.no.line("[crit]", true, 0)
end)

it("resolves DNS hostnames to send an http dispatch, return its response body", function()
pending("resolves DNS hostnames to send an http dispatch, return its response body", function()
local client = helpers.proxy_client()
finally(function() client:close() end)

Expand Down

0 comments on commit 294fffd

Please sign in to comment.