openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

Fixed input stream in mode serializing #124

Closed mslaga closed 1 year ago

mslaga commented 2 years ago

Signed-off-by: Michał Ślaga github@blinder.pl

ContentLength is optional in the HTTP header and cannot specify how much data will be copied to process. https://golang.org/src/net/http/request.go?s=12527:12599 // The value -1 indicates that the length is unknown.

and copy stderr to logs - it will be helpful for troubleshooting with function.

Description

Copy the req.InputReader stream to stdin in loop until EOF is reached.

Motivation and Context

Not works on slow machines like raspberry pi

https://github.com/openfaas/of-watchdog/issues/123

How Has This Been Tested?

In my case, on raspberry pi, the function always fails because of ContentLength -1

Types of changes

Checklist:

alexellis commented 1 year ago

I think I understand the challenge here.

Ideally, we want a setting to configure a maximum payload size for this mode. If you are running out of resources on an RPi, you should use the streaming or HTTP modes.