phpro / grumphp

A PHP code-quality tool
MIT License
4.11k stars 429 forks source link

Uncaught Amp\Serialization\SerializationException #1066

Closed mlunato47 closed 1 year ago

mlunato47 commented 1 year ago
Q A
Version 1.5.0
Bug? maybe?
New feature? no
Question? yes
Documentation?
Related tickets

Getting the following error when trying to make a commit using Grumphp, it is triggering this same error for every task I have Grumphp running.

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

I replaced information/project names with the XXX to sanitize it.

My configuration

# grumphp.yml
grumphp:
  fixer:
    enabled: true
    fix_by_default: false
  ascii:
  parallel:
    enabled: true
    max_workers: 32
  hide_circumvention_tip: true
  git_hook_variables:
    EXEC_GRUMPHP_COMMANDS: ddev exec php
  extensions:
    - GrumphpDrupalCheck\ExtensionLoader
  hooks_dir: ~
  tasks:
    yamllint: ~
    composer:
      no_check_all: true
    jsonlint: ~
    drupalcheck: ~
    phpcs:
      ignore_patterns:
        - "docroot/core/*"
        - "docroot/modules/contrib/*"
      encoding: utf-8
      triggered_by:
        - php
        - inc
        - module
        - install
        - profile
        - theme
        - feature
        - info
        - txt
        - md
        - test
        - css
      standard: Drupal,DrupalPractice
    twigcs:
      path: '.'
      severity: 'warning'
      display: 'all'
      ruleset: 'FriendsOfTwig\Twigcs\Ruleset\Official'
      triggered_by: ['twig']
      exclude: []

# Your actions
# Please add the steps on how to reproduce the issue here.
I have not taken any action to this yet because I am unsure if this is an error I can fix and just lack the knowledge or if this is a bug etc.
# Run GrumPHP:
git add -A && git commit -m"Test"

**Result:**

Getting this same message from the following tasks: yamllint, composer, jsonlint, drupalcheck, phpcs, twigcs

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

Please add the result of the run or git commit actions here.


yamllint
========

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

composer
========

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

jsonlint
========

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

drupalcheck
===========

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

phpcs
=====

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker

twigcs
======

Uncaught Amp\Serialization\SerializationException in worker with message "The given data could not be serialized: Laravel\SerializableClosure\Support\ReflectionClosure::__construct(): Argument #1 ($closure) must be of type Closure, Opis\Closure\SerializableClosure given, called in /Users/XXX/XXX_Project/Drupal-XXX/vendor/laravel/serializable-closure/src/Serializers/Native.php on line 302" and code "0"; use Amp\Parallel\Worker\TaskFailureException::getOriginalTrace() for the stack trace in the worker
veewee commented 1 year ago

It looks like your codebase is mixing Laravel\SerializableClosure and Opis\Closure somehow. You are on a older version of grumphp, does the issue persist when you upgrade? I can see in the release logs that newer versions tackled issues on parallel.

veewee commented 1 year ago

Closing this one because of inactivity If the issue still persists - feel free to reopen and provide some additional context.