avto-dev / roadrunner-laravel

[ABANDONED] Moved to https://github.com/spiral/roadrunner-laravel
MIT License
120 stars 15 forks source link

Invalid data #46

Closed nitrogenium closed 4 years ago

nitrogenium commented 4 years ago

Sometimes something goes wrong and I see a mistake like:

app_1 | INFO[1415] 172.23.0.1 {43.6ms} 500 GET http://localhost:4001/my_url worker error: invalid data found in the buffer (possible echo)

At the same time laravel.log - has nothing.

What is the best debugging strategy in this case? If I could quickly see this "invalid data", it would save bit time and improve developer experience :)

tarampampam commented 4 years ago

Can you provide more information?

nitrogenium commented 4 years ago

What kind of information is needed?

"invalid data found in the buffer (possible echo)" How can I look at this invalid data? At least.

tarampampam commented 4 years ago

If problem can be reproduced, and you can attach your code samples/configs/system info - I can try to reproduce and fix problem with you.

How can I look at this invalid data? At least.

Ask about whis in RR repository - this package is only bridge between Laravel framework and RR

nitrogenium commented 4 years ago

Thank you for the great package, by the way.

It's very easy to reproduce. Suppose that the controller accidentally contains "echo ('my_string')".

An error occurs: "invalid data found in the buffer (possible echo)"

How do I know that invalid data are "my_string" ? If I had seen the data or an error message that hits the buffer, I'd be happy.

Now I'm blind, it makes debugging very difficult.

tarampampam commented 4 years ago

Debugging using echo (or similar functions) is not possible (RR uses own format for interaction between worker and daemon). But (!) you can use stacked-dumper-laravel for this :)

nitrogenium commented 4 years ago

I know that :) For debugging, i use xdebug or \dev\dd | \dev\dump. It's just an illustration of the problem. Sometimes something hits the buffer and I have no idea what, where or how to find it. I was hoping for your advice.

tarampampam commented 4 years ago

Idea - change workers relay, reproduce your error, and watch for actual stdout? Or use global search for echo(), print(), fwrite() or similar functions?

nitrogenium commented 4 years ago

"Change workers relay, reproduce your error, and watch for actual stdout"

Sounds good :) But how I can apply it isn't quite clear yet.

Right now I have to use global search for echo(), print() and stuff like that. But I don't think it's the right approach. After all, the problem may be in an external package.

tarampampam commented 4 years ago

After all, the problem may be in an external package

Easy :)

Anyway relay changing must helps you (after that - we are open for your PR with "clean" way for this feature)

nitrogenium commented 4 years ago

After some thought, the best solution would be an option in roadrunner something like "Log invalid data".

Sometimes it's very difficult to reproduce the error, workers live long time, sometimes the error appears on the 50th request that came to the same worker. And it seems that the error appears directly from nothing.

Change workers relay - it may be useless for complicated scenarios.

IMHO

tarampampam commented 4 years ago

I agree with you. Close issue