Closed egonbraun closed 2 years ago
Hey @egonbraun 👋🏻 Could you please try to remove:
server:
command: "php /app/vendor/bin/rr-worker start"
relay: pipes
user: www-data <--- THIS
group: www-data <--- THIS
I suspect, that there are not enough permissions to open the file.
Hey @rustatian !
Surprisingly that fixed it. But now I have even more questions! hahahaha
I checked /tmp and it is properly set in my system:
$ ls -ld /tmp
drwxrwxrwt 1 root root 4096 Oct 7 14:57 /tmp
And this is how the www-data
user is set:
$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
So, are you suggesting this is a permissions issue or is Roadrunner doing something wrong?
Thanks for the fix!
Hey @egonbraun 👋🏻
So, I guess you started RR from the root
user, right?
Correct.
So, when the RR process creates a file in the tmp
folder, it creates it with the root
permissions. 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 👋🏻 If the issue was resolved, feel free to close it (if you don't have any questions) 😃
Done! Thanks!
But one thing I still don't get.
Roadrunner was indeed set to start as www-data
user as you can see in my config, and Roadrunner is the one responsible for starting the PHP process.
The main Roadrunner process was root but the workers were www-data
which I believe is a common daemon behaviour in Linux systems.
So, how can I do what you are proposing?
Thanks again!
It would be best if you did not generally start RR from the root
permissions. RR is not a webserver, it's the application server. It won't require root
permissions. Just create a user, then put www-data and the created user in the same group.
common daemon behaviour in Linux
Not all daemons require a root
. For example systemctl --user
systemd unit services.
Maybe I am just being dumb, so apologies for that. :)
Do you mean that the binary of roadrunner should be started as a user different than root? I mean, we user supervisor, so I can ask supervisor to start the roadrunner bootstrap script as a different user.
Yeah, if that's the case, then this is something I was definitely not doing. But it's totally doable.
No no, you're asking good questions. I'm thinking about the permissions... I mean, should we create tmp
files from the same user specified in the configuration? I guess yes. In this case, this is the RR bug... But, I don't think that the RR should be executed from the root
user.
But, PHP should not touch these files. The original problem I guess is the roadrunner-laravel
package, it should not touch the external files created by the RR.
Since we're not actively supporting this package (you know, we're busy with the SpiralFramework
, which doesn't have this problem), The better way to solve this problem would be a PR 😃
@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.
Got it! For now I will keep running rr
as root until this issue is fixed then.
Thanks @rustatian :)
My pleasure 👍🏻
It'll be fixed this week, and since we're already started v2.12.0
preparation, I'll release a v2.12.0-beta.1
with this fix, so you may safely use it.
@egonbraun 👋🏻 done: https://github.com/roadrunner-server/roadrunner/releases/tag/v2.12.0-alpha.1 😃
Hey @egonbraun 👋🏻 Have you had a chance to test the fix?
No duplicates 🥲.
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:
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).It's worth noting our applicating runs inside a Docker container.
Our roadrunner configuration:
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 theUploadedFile.php
Synfony class and it also did not workThanks!
Version (rr --version)
2.11.3
Relevant log output