roadrunner: [π BUG]: Fail to upload files
No duplicates π₯².
- I have searched for a similar issue in our bug tracker and didnβt find any solutions.
What happened?
When we tried to upload an image to our backend service the worker failed and the client received an HTTP 500 error message, the logs just stated that the file did not exist.
Our stack is running:
- PHP 8.1
- Laravel 9.28.0
- Roadrunner 2.11.3
- spiral/roadrunner-laravel 5.9.0
We noticed that the error happens before our code is even triggered, indicating that the issue happens while Laravel is building the request to send to out controller class. The error itself is triggered in the following file as part of the nyholm/psr7 library (I believe is a core dependency of Laravel or Synfony).
vendor/nyholm/psr7/src/Factory/Psr17Factory.php
Itβs worth noting our applicating runs inside a Docker container.
Our roadrunner configuration:
version: "2.7"
server:
command: "php /app/vendor/bin/rr-worker start"
relay: pipes
user: www-data
group: www-data
rpc:
listen: tcp://:6001
http:
address: 0.0.0.0:8000
pool:
num_workers: 0
max_jobs: 500
supervisor:
exec_ttl: 300s
logs:
mode: production
level: error
encoding: json
status:
address: localhost:2114
reload:
interval: 1s
patterns:
- ".php"
services:
http:
recursive: true
ignore:
- "bin"
- "database"
- "docs"
- "logs"
- "ops"
- "storage"
- "submodules"
- "tests"
- "tmp"
- "vendor"
patterns:
- ".json"
- ".md"
- ".php"
- ".py"
- ".sh"
- ".yml"
dirs:
- "."
I have checked the information provided in the caveats wiki section (which mentions a similar issue regarding the upload of files) and also the information in this issue.
I have also tried changing the isValid() function of the UploadedFile.php Synfony class and it also did not work
Thanks!
Version (rr --version)
2.11.3
Relevant log output
2022-10-06T15:35:18.412Z DEBUG server worker is allocated {"pid": 13716, "internal_event_name": "EventWorkerConstruct"}
2022-10-06T15:35:18.416Z INFO server In Psr17Factory.php line 49:
The file "/tmp/upload3578791433" cannot be opened:
start [--laravel-path [LARAVEL-PATH]] [--relay-dsn RELAY-DSN] [--refresh-app] [--worker-mode WORKER-MODE]
2022-10-06T15:35:18.419Z ERROR http execute {"start": "2022-10-06T15:35:18.158Z", "elapsed": "260.795709ms", "error": "sync_worker_exec_worker_with_timeout: Network:\n\tsync_worker_exec_payload: EOF"}
2022-10-06T15:35:18.419Z INFO http http log {"status": 500, "method": "POST", "URI": "/2.0/user/update", "remote_address": "127.0.0.1:43024", "read_bytes": 360038, "write_bytes": 0, "start": "2022-10-06T15:35:18.158Z", "elapsed": "261.082333ms"}
nginx access_log 172.18.0.1 "POST /2.0/user/update HTTP/1.1" 500 "curl/7.79.1" 0 0.263
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (12 by maintainers)
My pleasure ππ» Itβll be fixed this week, and since weβre already started
v2.12.0preparation, Iβll release av2.12.0-beta.1with this fix, so you may safely use it.Got it! For now I will keep running
rras root until this issue is fixed then.Thanks @rustatian π
@egonbraun Hey ππ» I looked at this problem a bit deeper; RR sends a file link to the PHP worker. So, this is a RR bug.
Done! Thanks!
So, when the RR process creates a file in the
tmpfolder, it creates it with therootpermissions. But child processes are created with a different user (www-data). Then, when a PHP process touches this file, it just has no permission to do that. In this case, I highly recommend using a regular user to start a RR with proper permissions.Hey @egonbraun ππ» Could you please try to remove:
I suspect, that there are not enough permissions to open the file.