getsentry / sentry-laravel

The official Laravel SDK for Sentry (sentry.io)
https://sentry.io
MIT License
1.25k stars 189 forks source link

Segmentation fault (core dumped) #309

Closed acrossoffwest closed 4 years ago

acrossoffwest commented 4 years ago

Require from composer.json:

        "php": ">=7.4.0",
        "barryvdh/laravel-cors": "^0.11.0",
        "botman/botman": "^2.5",
        "botman/driver-facebook": "^1.10",
        "brozot/laravel-fcm": "^1.2",
        "certifiedwebninja/caroline": "1.0.1",
        "doctrine/dbal": "^2.6",
        "egulias/email-validator": "^2.1",
        "firebase/php-jwt": "^5.0",
        "google/apiclient": "^2.0",
        "guzzlehttp/guzzle": "6.3.3",
        "illuminate/mail": "^6.0",
        "illuminate/redis": "^6.0",
        "intervention/image": "^2.4",
        "laravel/helpers": "^1.1",
        "laravel/lumen-framework": "^6.2.0",
        "league/flysystem": "^1.0",
        "nesbot/carbon": "^2.0",
        "phpseclib/phpseclib": "^2.0",
        "predis/predis": "^1.1",
        "sentry/sentry": "2.2.5",
        "sentry/sentry-laravel": "1.2.0",
        "snipe/banbuilder": "^2.3",
        "vlucas/phpdotenv": "^3.3",
        "webpatser/laravel-uuid": "^3.0",
        "zytzagoo/smtp-validate-email": "dev-master"

When I tried throw Exception I catch: Segmentation fault(core dump)

For example on "sentry/sentry": "^2.0" and "sentry/sentry-laravel": "1.2.0" I catch these errors:

Deprecated: Function ReflectionType::__toString() is deprecated in /var/www/html/vendor/sentry/sentry/src/Serializer/AbstractSerializer.php on line 331

Deprecated: Function ReflectionType::__toString() is deprecated in /var/www/html/vendor/sentry/sentry/src/Serializer/AbstractSerializer.php on line 331

Deprecated: Function ReflectionType::__toString() is deprecated in /var/www/html/vendor/sentry/sentry/src/Serializer/AbstractSerializer.php on line 331

Deprecated: Function ReflectionType::__toString() is deprecated in /var/www/html/vendor/sentry/sentry/src/Serializer/AbstractSerializer.php on line 331

Deprecated: Function ReflectionType::__toString() is deprecated in /var/www/html/vendor/sentry/sentry/src/Serializer/AbstractSerializer.php on line 331
Segmentation fault (core dumped)

For example on "sentry/sentry": "2.2.5" and "sentry/sentry-laravel": "1.5.0" I catch only: Segmentation fault (core dumped)

I don't know what happened maybe somebody caught this and resolved?

Upd: While It's only in scheme migration:

class AddIndexToUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->index('id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropIndex([
                'id',
                'wront_value'
            ]);
        });
    }
}

Here I included wrong index and after it I caught Segmentation fault Upd: PHP Version: 7.4

stayallive commented 4 years ago

Hmm, could you also share the exact version of PHP you are using when the segmentation fault occurred?

acrossoffwest commented 4 years ago

@stayallive 7.4

sidvanvliet commented 4 years ago

I am experiencing the same issue.

stayallive commented 4 years ago

@acrossoffwest are you able to consistently trigger this using the php artisan migrate:rollback command?

When trying your composer.json I am unable to trigger this on OS X (with your composer requirements and just a clean Lumen with Sentry configured):

PHP 7.4.0 (cli) (built: Nov 29 2019 16:18:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

@sidvanvliet are you also on Lumen and PHP 7.4? Could you share your composer.json.

Could you both tell me a bit more about the machine you are running into this like the OS & output from php -v?


Edit: Sharing your bootstrap/app.php could also help to see what's enabled / configured that might be able to cause the event leading to the segfault.

sidvanvliet commented 4 years ago

@stayallive I am using using Laravel Framework 6.4 with PHP 7.4.0 on a MacBook Pro running version 10.15 (Catalina)

Here is the php -v output:

PHP 7.4.0 (cli) (built: Nov 29 2019 16:18:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies

My composer.json looks like this:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.4",
        "ext-json": "*",
        "facade/ignition": "^1.4",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "intervention/image": "^2.5",
        "laravel/framework": "6.4.*",
        "laravel/horizon": "^3.4",
        "laravel/slack-notification-channel": "^2.0",
        "laravel/telescope": "^2.1",
        "laravel/tinker": "^1.0",
        "owen-it/laravel-auditing": "9.3.*",
        "predis/predis": "^1.1",
        "sentry/sentry-laravel": "1.3.*",
        "spatie/laravel-translatable": "^4.1"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.2",
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "files": [
            "app/Helpers/GeneralHelper.php"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

And my bootstrap/app.php looks like this (default):

<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/

$app = new Illuminate\Foundation\Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);

/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/

$app->singleton(
    Illuminate\Contracts\Http\Kernel::class,
    App\Http\Kernel::class
);

$app->singleton(
    Illuminate\Contracts\Console\Kernel::class,
    App\Console\Kernel::class
);

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class
);

/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/

return $app;
stayallive commented 4 years ago

@sidvanvliet ah, I wondered why your bootstrap/app.php looked like that but as you said you are on the full framework, in that case it's not relevant but thanks for sharing :)

Can you also share what exactly you do or what happens in your app when the segfault occurs?

acrossoffwest commented 4 years ago

And one more moment I'm using Docker with image: php:7.4.0-fpm-buster

sidvanvliet commented 4 years ago

@stayallive It happened when a job failed.

stayallive commented 4 years ago

Can any of you two share or extract a reliable reproduction out of where it fails for you because I'm unable to make it happen still.

My best guess is this is a 7.4 bug and is triggered by our error tracking or trying to access something from the shutdown function (wouldn't be the first time) but it's extremely tricky to find a reproduction so we can try and figure out if we can fix this.

acrossoffwest commented 4 years ago

I tried to repeat this issue on new lumen project and it worked fine.

stayallive commented 4 years ago

If by any chance you run into it again please do let us know if you have more info so we can investigate further!