-
Notifications
You must be signed in to change notification settings - Fork 53
Description
After updating to nginx version 1.2.2, a debug log line in njs.d/dns/dns.js looks like it causes a memory exception:
2023/03/18 07:57:25 [error] 1384#1384: *270 js exception: MemoryError while proxying and sending to client, client: 127.0.0.1, server: 127.0.0.1:8053, upstream: "127.0.0.1:7053", bytes from/to client:140/0, bytes from/to upstream:43/27
2023/03/18 07:57:25 [error] 1384#1384: *267 upstream prematurely closed connection while reading response header from upstream, client: 104.244.223.30, server: query.doh.example.org, request: "POST /dns-query HTTP/2.0", upstream: "http://127.0.0.1:8053/dns-query", host: "query.doh.example.org"
After I added several more debug lines to see where the problem happened, I narrowed it down to this:
debug(s, "DNS Res Packet: " + JSON.stringify( Object.entries(packet)) );
(Note that the earlier debug line that dumps packet.answers to the log does work.)
I'm not skilled enough with JavaScript or the Nginx JS module to narrow down further, my apologies. But commenting out this line and making no other changes allows the module to work again. From what little I do know, I don't see an obvious reason why this log line would up and fail.
For context, my DoH setup is based on Scott Helme's instructions to use Nginx + DoH + Pi Hole, extended from the Nginx blog.