per Eugene’s earlier guidance, I went ahead and implemented processing the upstream request in a separate thread (i.e. not on the event loop) and sending the response back via ziti transport on the event loop. The latest code uses the invocation uv_queue_work(uv_thread_loop, work, process_upstream, respond_to_client);
I have verified via debugger that processing of the function process_upstream(uv_work_t *work)
occurs on a separate thread. My problem at this time is that the 2nd callback respond_to_client(uv_work_t *work, int status)
, i.e. the ‘after processing’ is never invoked. Would you have any pointers as to what I can investigate next to fix this?
Here’s relevant detail from the logs:
[ 4.583] VERBOSE ../library/connect.c:781 conn_inbound_data_msg() conn[0.1] decrypting 94 bytes
[ 4.583] VERBOSE ../library/connect.c:785 conn_inbound_data_msg() conn[0.1] decrypted 77 bytes
[ 4.583] TRACE ../library/connect.c:736 flush_to_client() conn[0.1] flushing 77 bytes to client
[ 4.583] DEBUG /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:275 ngx_ziti_downstream_on_client_data() client sent 77 bytes
[ 4.583] TRACE /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:276 ngx_ziti_downstream_on_client_data() client sent these 77 bytes:
GET / HTTP/1.1
Host: odoo.ngx.ziti
User-Agent: curl/7.64.1
Accept: */*
[ 4.584] DEBUG /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:393 talk_to_upstream() ngx_ziti_downstream: request sent upstream. 77 bytes
[ 4.584] DEBUG /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:413 talk_to_upstream() ngx_ziti_downstream: response received from upstream. 552 bytes
[ 4.584] TRACE /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:414 talk_to_upstream() response from upstream server 552 bytes:
HTTP/1.0 303 SEE OTHER
Content-Type: text/html; charset=utf-8
Content-Length: 215
Location: http://odoo.ngx.ziti/web
Set-Cookie: session_id=d0b15c0e45759a222d3d106691062108a19231d5; Expires=Tue, 24-Aug-2021 15:30:47 GMT; Max-Age=7776000; HttpOnly; Path=/
Server: Werkzeug/0.16.1 Python/3.8.6
Date: Wed, 26 May 2021 15:30:47 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="/web">/web</a>. If not click the link.
[ 4.584] DEBUG /Users/oluetkeh/Developer/ngx_ziti_downstream/src/ngx_ziti_downstream_module.c:308 process_upstream() finished upstream communication, got 552 bytes
[ 5.544] TRACE _deps/uv-mbed-src/src/tls_link.c:112 TLS(0x1005046c0)[2]: 100
thx
Olaf