brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.11k stars 366 forks source link

Weird errors popping up occassionally #1555

Closed RikudouSage closed 6 months ago

RikudouSage commented 1 year ago

Description:

I got weird errors from time to time and I can't pinpoint why:

How to reproduce:

It's this project: https://github.com/RikudouSage/SlackChatGPT

Configure .env variables and deploy using serverless.

mnapoli commented 1 year ago

Hi, any reason to think this is related to Bref?

RikudouSage commented 1 year ago

Well, something like that never happened to me on a standard setup, bref is the only non-standard thing in the stack. I can't really think of anything else causing this.

Edit: Especially the 2nd error sounds like something's wrong with the runtime.

mnapoli commented 1 year ago

I spent 5 minutes looking into this and indeed, the errors don't make any sense…

I have no idea, only throwing random ideas: could it be the cache created locally is very different to the code deployed in Lambda? Could it be something with opcache caching alternative versions of the file (but why and how)?

Oh also just to be sure: could it be PHP objects serialized and sent to SQS, and then a deployment happens, and the worker deserializes the objects but the code has changed in the meantime?

Nothing serialized into the DB either?

Cool project btw!

RikudouSage commented 1 year ago

could it be the cache created locally is very different to the code deployed in Lambda?

Nope.

Could it be something with opcache caching alternative versions of the file (but why and how)?

That's the only conclusion I came to, but the why and how still escapes me.

could it be PHP objects serialized and sent to SQS, and then a deployment happens, and the worker deserializes the objects but the code has changed in the meantime?

In theory yes, but those weren't the cases. Also the first and second error couldn't happen because of serialization, only the property values are serialized.

Nothing serialized into the DB either?

Nothing that seems related, there's only Symfony's rate limiter SlidingWindow object serialized.

Cool project btw!

Thanks!

Currently I've disabled the advanced opcache parameters and am waiting to see if that solved it.

mnapoli commented 1 year ago

Ohh the jit could be the culprit maybe 🤔

mnapoli commented 6 months ago

Closing because of inactivity.