fission / environments

A set of language environments for Fission
https://fission.io/environments/
Apache License 2.0
27 stars 49 forks source link

php-env only answers one request #146

Open torblerone opened 3 years ago

torblerone commented 3 years ago

Fission/Kubernetes version

$ fission version
client:
  fission/core:
    BuildDate: "2021-08-03T11:34:27Z"
    GitCommit: 9b5eb069d69d47d22ecc0270bf8619857ea3f19f
    Version: 1.14.1
server:
  fission/core:
    BuildDate: "2021-08-03T09:53:20Z"
    GitCommit: 9b5eb069d69d47d22ecc0270bf8619857ea3f19f
    Version: 1.14.1

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3+k3s1", GitCommit:"1d1f220fbee9cdeb5416b76b707dde8c231121f2", GitTreeState:"clean", BuildDate:"2021-07-22T20:52:14Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}

Kubernetes platform (e.g. Google Kubernetes Engine) k3s Describe the bug

When I create a PHP environment like so:

$ fission env create --name php73 --builder "fission/php-builder" --version=2 --image "fission/php-env"

and deploy a basic function to it:

$ cat hello.php
<?php
echo "Hello from PHP";
$logger->warning("Hello logger");

$ fission fn create --name "phpnew" --code hello.php --method GET --env php73 

and then try to run it multiple times:

  $ for i in {1..100}
> do
> fission fn test --name phpnew
> sleep 1 && echo $i
> done

You can see in the output that the function does not get called cleanly everytime and often does not respond with the "Hello from PHP" as expected:

Hello from PHP1
2
3
4
5
6
7
8
9
10
11
Hello from PHP12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Hello from PHP32
33
^C

To Reproduce

Install fission via Helm (without Prometheus) as provided in the Official Documentation. Then do above steps.

Expected result

I want to make sure that every function call gets answered in a proper way. Thus, every call from above should be responded with "Hello from PHP".

Actual result

Only sporadically, the function gets called and I get a correct response.

Screenshots/Dump file

If needed, please tell me if you need a dump for this issue and what exact files are needed. I need to make sure that sensitive company informations are omitted.

Additional context

I noticed that everytime I get a correct response Hello from PHP, a new poolmgr Pod is being created. Maybe it's an issue that the PHP environment never closes the request properly and is only capable of answering exactly one request?

Edit: I've also tried it with your standard python-env and was not able to reproduce this issue there. It must have got to do something with that specific container image.

pehbehbeh commented 2 years ago

Same issue here.

$ fission version
client:
  fission/core:
    BuildDate: "2021-12-29T03:57:30Z"
    GitCommit: 327275d1
    Version: v1.15.1
server:
  fission/core:
    BuildDate: "2021-12-29T03:57:30Z"
    GitCommit: 327275d1
    Version: v1.15.1

We are using fission/php-env:1.31.1 as an environment image.

torbendury commented 2 years ago

Same thing happening to us unfortunately.

checkin247 commented 1 year ago

Had the same issue. Found the solution!

Function works exactly once per pod started.

in server.php change: require_once $codePath; to require $codePath;

@sanketsudake

checkin247 commented 1 year ago

@sanketsudake please check the pull request https://github.com/fission/environments/pull/292

checkin247 commented 1 year ago

there is also a PHP8.2 environment which has this issue fixed https://github.com/checkin247/fission-environments/tree/php8-2

in case someone is interested, its a fork of the php7 environment.