roadrunner-server / roadrunner

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

[🐛 BUG]: Incorrect header encoder #2043

Closed bzajacc closed 1 day ago

bzajacc commented 1 day ago

No duplicates 🥲.

What happened?

After migration to latest version of RR, every request throwing this error:

2024-11-06 13:39:10 [INFO] RoadRunner server started; version: 2024.2.1, buildtime: 2024-09-12T16:25:02+0000
2024-11-06 13:39:10 [INFO] sdnotify: not notified
2024-11-06 13:39:10 2024-11-06T12:39:10+0000    DEBUG   http            http server was started {"address": "0.0.0.0:80"}
2024-11-06 13:40:49 JsonException {#3119
2024-11-06 13:40:49   #message: "Control character error, possibly incorrectly encoded"
2024-11-06 13:40:49   #code: 3
2024-11-06 13:40:49   #file: "/app/vendor/spiral/roadrunner-http/src/HttpWorker.php"
2024-11-06 13:40:49   #line: 60
2024-11-06 13:40:49   trace: {
2024-11-06 13:40:49     /app/vendor/spiral/roadrunner-http/src/HttpWorker.php:60 { …}
2024-11-06 13:40:49     /app/vendor/baldinof/roadrunner-bundle/src/RoadRunnerBridge/HttpFoundationWorker.php:29 { …}
2024-11-06 13:40:49     /app/vendor/baldinof/roadrunner-bundle/src/Worker/HttpWorker.php:93 { …}
2024-11-06 13:40:49     /app/vendor/baldinof/roadrunner-bundle/src/Runtime/Runner.php:33 { …}
2024-11-06 13:40:49     /app/vendor/autoload_runtime.php:30 { …}
2024-11-06 13:40:49     /app/public/index.php:5 {
2024-11-06 13:40:49       › 
2024-11-06 13:40:49       › require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
2024-11-06 13:40:49       › 
2024-11-06 13:40:49       arguments: {
2024-11-06 13:40:49         "/app/vendor/autoload_runtime.php"
2024-11-06 13:40:49       }
2024-11-06 13:40:49     }
2024-11-06 13:40:49   }
2024-11-06 13:40:49 }
2024-11-06 13:40:49 
2024-11-06 13:40:49 2024-11-06T12:40:49+0000    ERROR   http            execute {"start": "2024-11-06T12:40:24+0000", "elapsed": 24767, "error": "sync_worker_receive_frame: Network: EOF"}
2024-11-06 13:40:49 2024-11-06T12:40:49+0000    INFO    http            http log        {"status": 500, "method": "GET", "URI": "/health", "URL": "/health", "remote_address": "192.168.65.1:64250", "read_bytes": 0, "write_bytes": 40, "start": "2024-11-06T12:40:24+0000", "elapsed": 24773}

After analysis, I found that the problem is in incorrect header encoding like below: image

we have other application with same config rr.yaml, and Dockerfile - every think works fine.

Version (rr --version)

latest 2024.2.1

How to reproduce the issue?

# rr.yaml
version: "3"

status:
  address: 0.0.0.0:2114

server:
  command: "php public/index.php"
  env:
    - APP_RUNTIME: Baldinof\RoadRunnerBundle\Runtime\Runtime

http:
  raw_body: true
  address: 0.0.0.0:80
  pool:
    debug: false
    num_workers: 8
  access_log: true
  middleware: [ "http_metrics", "static", "gzip" ]
  uploads:
    forbid: [ ".php", ".exe", ".bat" ]
  static:
    dir: "public"
    forbid: [ ".php", ".htaccess" ]

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

rpc:
  listen: tcp://127.0.0.1:6001

metrics:
  address: "0.0.0.0:9181"

Using integration https://github.com/Baldinof/roadrunner-bundle

# integration config
baldinof_road_runner:
    kernel_reboot:
        strategy: always

    metrics:
        enabled: false

run serwer on docker.

PHP 8.3.13 (cli) (built: Oct 24 2024 16:04:13) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.13, Copyright (c), by Zend Technologies
    with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans

Im using http_request from intelij, but every request causing it:

# intelij http_request
GET http://127.0.0.1:8081/health
Accept: application/json
Content-Type: application/json
curl 127.0.0.1:8081/health

Relevant log output

No response

rustatian commented 1 day ago

Cześć, @bzajacc 👋 You're probably using the outdated spiral/php or spiral/worker packages. Could you please post your composer.json here?

bzajacc commented 1 day ago

Oh, you are right... this integration package is outdated.. i will try downgrade rr-serwer on docker :)

Using this libs:

image
rustatian commented 1 day ago

Yeah, starting from the v2024 you need to update worker and http PHP packages: https://docs.roadrunner.dev/docs/general/compatibility#upgrading-to-roadrunner-v2024.1.x

bzajacc commented 1 day ago

Yes, you are right.. I just need to run composer upadate baldinof/roadrunner-bundle -W with this -W flag for update with dependencies.

Thanks a lot! :)

rustatian commented 1 day ago

You're welcome, enjoy RR 👍