Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 BUG]: Response status 200 instead of 500 in debug mode if php code fails #1843

Closed
1 task done
Volonda opened this issue Jan 24, 2024 · 4 comments · Fixed by roadrunner-server/http#198
Closed
1 task done
Assignees
Labels
B-bug Bug: bug, exception
Milestone

Comments

@Volonda
Copy link

Volonda commented Jan 24, 2024

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

I have php script in server.command and http.pool.debug:true.

If my php code fails before new \Spiral\RoadRunner\Http\PSR7Worker() rr return 200 OK and
body with exception message. I cant't set status 500 in $psr7->respond().
Is there way to change response status from 200 to 500?

Version (rr --version)

rr version 2023.3.5 (build time: 2023-11-16T14:06:28+0000, go1.21.4), OS: linux, arch: amd64

How to reproduce the issue?

php code fails before new \Spiral\RoadRunner\Http\PSR7Worker()

Relevant log output

http://172.22.0.2:81/send-private-message

HTTP/1.1 200 OK
Date: Wed, 24 Jan 2024 15:03:51 GMT
Content-Length: 287
Content-Type: text/plain; charset=utf-8

goridge_frame_receive: validation failed on the message sent to STDOUT, see: https://roadrunner.dev/docs/known-issues-stdout-crc/current/en, invalid message: 
Fatal error: Uncaught RuntimeException: asdasd in /app/bin/mamba:4
Stack trace:
#0 {main}
  thrown in /app/bin/mamba on line 4
@rustatian
Copy link
Member

Hey @Volonda 👋
Could you check the response code without the debug option set to true?

@Volonda
Copy link
Author

Volonda commented Jan 24, 2024

with debug:false my docker container go down. It looks ok because actually there is no worker
Screenshot from 2024-01-24 18-21-30

@rustatian
Copy link
Member

No, this is because of that error in your PHP code. RR can't bring up even a single worker (and this is ok). Ok, I'll double-check your case.

@Volonda
Copy link
Author

Volonda commented Jan 24, 2024

test.php

<?php
throw new \RuntimeException('asdasd');

.rr.yaml

server:  
  command: "php test.php"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: bug, exception
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants