-
Notifications
You must be signed in to change notification settings - Fork 107
Description
I've managed to isolate an issue where a queue trigger function is unable to call an http endpoint from a function with the same app. This behavior manifests when the functions are synchronous or asynchronous.
Repro steps
Provide the steps required to reproduce the problem:
- The offending code is here: QueueWithHttpCall.zip. There is a function called
QueueTriggerPython
which pulls items from queues and triggers aGET
request to an endpoint (from theIntakeHttpTrigger
function). - Activate virtual environment and install requirements:
pip install -r requirements.txt
. - Install extensions:
func extensions install
- Configure
local.settings.json
to point to the storage account that you are using. - Run
func host start
and then add item to the configured queue.
Expected behavior
The queue trigger should be able to successfully call into the HTTP endpoint and return the correct status code as well as print out the log message to the console.
Actual behavior
The queue trigger is activated but hangs when trying to call the HTTP endpoint, getting stuck at the following point:
Executing 'Functions.IntakeHttpTrigger' (Reason='This function was programmatically called via the host APIs.', Id=411d2a47-71de-4ab1-b231-c99a9794a7cb)
This is after the point at which the host calls into the language worker to process the request.
Known workarounds
-
Both
QueueTriggerPython
andIntakeHttpTrigger
are synchronous. Raise the number of workers indispatcher.py
to 2:max_workers=1) -
Both
QueueTriggerPython
andIntakeHttpTrigger
are asynchronous. No known workarounds.
Related information
For the sync case, there appears to be some issue with the worker threads which are blocking themselves rather than processing the request from a function in the same app. This would explain why raising the number of thread workers to 2 caused the call to go through (one thread for queue trigger and one for the subsequent http call it makes). For the async case, it might be a manifestation of a similar issue since we are executing in the main event loop rather than using a separate thread pool.