roadrunner-server / roadrunner

🤯 High-performance PHP application server, process manager written in Go and powered with plugins
https://docs.roadrunner.dev
MIT License
7.92k stars 411 forks source link

[BUG] Does not start with FCGI #701

Closed alumnihabbim closed 3 years ago

alumnihabbim commented 3 years ago

The current configuration is:

server:
  # command: "php bin/console baldinof:roadrunner:worker"
  # If you are using symfony 5.3+ and the new Runtime component:
  # remove the previous `command` line above and uncomment the line below.
  command: "php public/index.php"
  env:
    - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime

http:
  address: 0.0.0.0:8080
  middleware: [ "static", "gzip"]
  uploads:
    forbid: [ ".php", ".exe", ".bat" ]
  static:
    dir: "public"
    forbid: [ ".php", ".htaccess" ]
  fcgi:
    address: tcp://0.0.0.0:7921
logs:
  mode: production
  channels:
    http:
      level: debug # Log all http requests, set to info to disable
    server:
      level: info # Everything written to worker stderr is logged
      mode: raw
    metrics:
      level: error

When starting I get the following trace:

panic: runtime error: invalid memory address or nil pointer dereference
 [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb3270d]

goroutine 24 [running]:
github.com/spiral/roadrunner/v2/plugins/http.applyMiddlewares(0x0, 0xc0001b61b0, 0xc0004739b0, 0x3, 0x3, 0x1586b20, 0xc0001ac050)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/serve.go:244 +0xad
github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serveFCGI(0xc0000e5c80, 0xc0001b84e0)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/serve.go:76 +0x2ef
github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serve.func3(0xc0000e5c80, 0xc0001b84e0)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/plugin.go:205 +0x35
created by github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serve
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/plugin.go:204 +0x6f8

I am using a symfony 5.3 based application

rustatian commented 3 years ago

Hey @alumnihabbim. You may safely remove static from middlewares. Could you please try w/o that option?

rustatian commented 3 years ago

@alumnihabbim I found a problem. I will resolve it in the 2.3.0, which will be released on 8 of June. Starting from the 2.2.0 release, static will be applied automatically if you have a static section in your .rr.yaml (so, you can remove it from the middlewares).

alumnihabbim commented 3 years ago

@48d90782 I have tried to remove it and it works.

But in http mode you would need to serve static files.

rustatian commented 3 years ago

@48d90782 I have tried to remove it and it works.

Nice to hear

But in http mode you would need to serve static files.

Static middleware will be added automatically. It's not a problem to leave it in the middlewares just for the sake of presence.

alumnihabbim commented 3 years ago

@48d90782 Sorry, in the previous test I also removed the static node from the config, only removing static from middleware I get a very similar error trace, it only starts if there is no presence of the static config:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb3270d]

goroutine 24 [running]:
github.com/spiral/roadrunner/v2/plugins/http.applyMiddlewares(0x0, 0xc0001b9aa0, 0xc000564a80, 0x2, 0x2, 0x1586b20, 0xc00000ffb8)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/serve.go:244 +0xad
github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serveFCGI(0xc0000e5c80, 0xc0002040c0)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/serve.go:76 +0x2ef
github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serve.func3(0xc0000e5c80, 0xc0002040c0)
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/plugin.go:205 +0x35
created by github.com/spiral/roadrunner/v2/plugins/http.(*Plugin).serve
github.com/spiral/roadrunner/v2@v2.2.1/plugins/http/plugin.go:204 +0x6f
rustatian commented 3 years ago

Yeah, I found the issue, thanks 👍🏻

rustatian commented 3 years ago

@alumnihabbim in the master branch now