buggregator / server

Buggregator is a lightweight, standalone server that offers a range of debugging features for PHP applications.
https://buggregator.dev/
Other
648 stars 23 forks source link

Buggregator server doesn't catch var-dumps in specific cases #60

Closed roxblnfk closed 9 months ago

roxblnfk commented 1 year ago

Buggregator server doesn't catch var-dumps in specific cases

For example, I installed temporal/samples-php project and modified \Temporal\WorkerFactory (vendor package) like this:

    public function run(HostConnectionInterface $host = null): int
    {
        $host ??= RoadRunner::create();
        $this->codec = $this->createCodec();

        while ($msg = $host->waitBatch()) {
            try {
                \dump($msg->messages, $msg->context);
                $response = $this->dispatch($msg->messages, $msg->context);
                \dump($response); // line 263
                $host->send($response);
            } catch (\Throwable $e) {
                $host->error($e);
            }
        }

        return 0;
    }

After rr serve Buggregator Server doesn't catch responses. But buggregator/trap does. {2A755B17-C290-41ED-ABAF-217CD3DD693B}

Need to research the problem.

FluffyDiscord commented 1 year ago

By the payload size, it may be because it's reaching the default nginx proxy limit of 1MB which should be fixed with next release https://github.com/buggregator/server/pull/66 already released https://github.com/buggregator/server/releases/tag/1.0-rc9

roxblnfk commented 1 year ago

I'll check it. Thanks.

roxblnfk commented 1 year ago

Now I have error messages like this:

2023-09-06T13:41:32.481Z        ERROR   app             TypeError: Spiral\RoadRunnerBridge\Centrifugo\Broadcast::publish(): Argument #2 ($messages) must be of type iterable|string, bool given, called in /app/app/src/Application/Broadcasting/BroadcastEventInterceptor.php on line 28 in /app/vendor/spiral/roadrunner-bridge/src/Centrifugo/Broadcast.php at line 17 [] []

And missed messages.

The content is quite short (847 bytes). image

FluffyDiscord commented 1 year ago

probably due to dependency update https://github.com/buggregator/server/commit/6cdfe5408c338b715202b7b627b0685c392679f9#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34L43 @butschster

butschster commented 12 months ago

Probably the problem is with payload, as I see it contains binary data, so when buggregator app tries to broadcast data

$this->broadcast->publish(
    $event->getBroadcastTopics(),
    \json_encode([
        'event' => $event->getEventName(),
        'data' =>  $event->jsonSerialize(),
    ])
);

it endodes data into json and as I think, json_encode returns false when it tries to encode binary data

FluffyDiscord commented 9 months ago

Just run into this issue. Any way for Buggregator to handle this correctly? VarDump shows the string binary correctly, adding the b indicator, just Buggregator seems to not be able to handle it.

roxblnfk commented 9 months ago

Could you share your dumped binary data?

FluffyDiscord commented 9 months ago

Can't, it was a confidential ~10MB of PDF.

roxblnfk commented 9 months ago

Got it. I've reproduced it using Buggregator logo