Skip to content

HTTP Request Failure Handling #820

Open
@aslanpour

Description

Hi all, I am sending async requests to a function and a call-back is set to receive the responses on a client. I also set some headers for requests, so I can attribute the function's response to the corresponding sender.
Also, while serving requests, there is a chance that my function is down temporarily, say due to rescheduling the Pods. In that case, I am receiving a 50X status code on my client and the headers I set are missed. Is there any way I can identify a request when returning a 50X status code?
I also see OpenFaaS sets some headers on the request such as X-Start-Time, X-Duration-Seconds, etc. In the case of returning status code 500, sometimes the X-Start-Time header is also missed in the response. For me, this 500 happens when the function is rescheduled or deleted while the request is being executed.

Thanks,
Mohammad

Expected Behaviour

Headers set users (senders) and sometimes headers set by OpenFaaS on requests should not be missed.

Not a solution I have as I need more understanding of OpenFaaS components.

Current Behaviour

Headers are missed when a function responsible for executing a request is failed or being rescheduled.

No suggestion

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

I think queue-worker or gateway need to take care of headers if they are not.

A failure handling for function invocation would help.

I have no idea.

Which Solution Do You Recommend?

I would assign a reliable component such as queue-worker or gateway to handle the failures.

Steps to Reproduce (for bugs)

No link

A sample Python code I use in a Flask server for sending requests.
url = 'http://'+gateway_IP + ':31112/async-function/myfunction'
header = {'X-Callback-Url':'http://' + client_IP + ':5000/actuator',
'Sensor-ID': sensor_id}
response=requests.post(url, headers=header)

And on the client, I verify the header by this:

print(str(request.headers))

Context

I am trying to verify which sender's request is failed.

Provided

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
    0.13.13
  • Docker version docker version (e.g. Docker 17.0.05 ):
    ...
  • What version and distriubtion of Kubernetes are you using? kubectl version
    k3s version 21
  • Operating System and version (e.g. Linux, Windows, MacOS):
    Raspbian
  • Link to your project or a code example to reproduce issue:
    none
  • What network driver are you using and what CIDR? i.e. Weave net / Flannel
    none

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions