Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Request Failure Handling #820

Open
1 of 2 tasks
aslanpour opened this issue Jul 27, 2021 · 3 comments
Open
1 of 2 tasks

HTTP Request Failure Handling #820

aslanpour opened this issue Jul 27, 2021 · 3 comments

Comments

@aslanpour
Copy link

aslanpour commented Jul 27, 2021

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
@alexellis
Copy link
Member

Hi @aslanpour

We are going to need exact steps to be able to help you and a sample function. If you don't provide this then unfortunately, we'll have to close your support request.

Regards,

Alex

@alexellis
Copy link
Member

/add labels: support,question

@alexellis
Copy link
Member

@aslanpour please see my comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants