Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDOException: could not find driver, upon re-run job it ok #606

Closed
3 of 5 tasks
kevincobain2000 opened this issue Jun 17, 2022 · 8 comments
Closed
3 of 5 tasks

PDOException: could not find driver, upon re-run job it ok #606

kevincobain2000 opened this issue Jun 17, 2022 · 8 comments
Assignees
Labels
bug Something isn't working self-hosted

Comments

@kevincobain2000
Copy link

kevincobain2000 commented Jun 17, 2022

Describe the bug

We see PDO errors on first run, and second run upon manual re-run job always succeeds with the same workflow file

Illuminate\Database\QueryException: could not find driver (SQL: PRAGMA foreign_keys = OFF;)
Caused by
PDOException: could not find driver

Version

  • I have checked releases, and the bug exists in the latest patch version of v1 or v2.
  • v2
  • v1

Runners

Operating systems
linux

PHP versions
8.1

To Reproduce

      - name: Install PHP with extensions
        uses: shivammathur/setup-php@v2
        with:
          coverage: pcov
          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
          ini-values: pcre.jit=1,memory_limit=-1,disable_functions="",pcov.exclude="~(vendor|tests|node_modules)~",pcov.directory="./"
          php-version: ${{ matrix.php-versions }}
          tools: composer:v2
        env:
          runner: self-hosted

      - name: PHPUNIT Tests with Code Coverage
        run: |
            ./vendor/bin/phpunit --configuration phpunit.xml --coverage-clover build/coverage.xml --coverage-html build/coverage

Expected behavior
Setup PHP doesn't fail, but phpunit almost always fails whenever a push is made (first run). Interestingly, when we re-run manually by Re-run jobs, it succeeds.

Screenshots/Logs

Run shivammathur/setup-php@v2
/usr/bin/bash /_work/_actions/shivammathur/setup-php/v2/src/scripts/run.sh

==> Setup PHP
✓ PHP Found PHP 8.1.7

==> Setup Extensions
✓ intl Enabled
✓ gd Enabled
✓ zip Enabled
✓ pdo Enabled
✓ sqlite3 Enabled
✓ pdo_sqlite Enabled
✓ dom Enabled
✓ curl Enabled
✓ libxml Enabled
✓ mbstring Enabled
✓ fileinfo Enabled
✓ exif Enabled
✓ iconv Enabled

==> Setup Tools
✓ composer Added composer 2.3.7

==> Setup Coverage
✓ pcov.enabled=1 Added to php.ini
✓ coverage: pcov PCOV enabled as coverage driver

==> Add php.ini values
✓ pcre.jit=1 Added to php.ini
✓ memory_limit=-1 Added to php.ini
✓ disable_functions= Added to php.ini
✓ pcov.exclude='~(vendor|tests|node_modules)~' Added to php.ini
✓ pcov.directory=./ Added to php.ini

==> #StandWithUkraine
✓ read-more https://setup-php.com/support-ukraine

Additional context

Are you willing to submit a PR?

@kevincobain2000 kevincobain2000 added the bug Something isn't working label Jun 17, 2022
@shivammathur
Copy link
Owner

@kevincobain2000

Please provide me either a minimal public repo or access to a private repo reproducing the issue.

@kevincobain2000
Copy link
Author

Thanks that'd be little difficult, since it is an enterprise application. I posted it to see if it is an issue known to your knowledge with self-hosted runners.
The repo is just a Laravel application with phpunit, nothing special. The problem is not with the repo I would think, because upon manual re-run the job always goes to success. Only the first run (upon commit, it fails). I have also checked if the sqlite DB_CONNECTION is properly set on cache and envs.

@kevincobain2000
Copy link
Author

Oddly, on the first job trigger, it also says no coverage driver, which upon hitting re-run jobs, the warning disappears as well.

@kevincobain2000
Copy link
Author

Sorry to have kept this open. It is ok to close this as I can’t provide you with the sample repository unfortunately.

@shivammathur
Copy link
Owner

ok. I will try to recreate it using the runner image you use this weekend with Laravel as the app. Will close it then.

@kevincobain2000
Copy link
Author

Recently I added the following to the workflow and since then the issue has not appeared. I am not sure if that is what caused PHP extensions to go dark sometimes. But let me post an update if that is helpful

    steps:
      - name: Clear any existing tool cache
        run: |
          rm -rf "${{ runner.tool_cache }}" || true

@shivammathur
Copy link
Owner

da9dfe4 should fix this. Try without removing the tool cache directory and let me know if it works without that.

@kevincobain2000
Copy link
Author

Thanks for closing this, I ll post an update after 1-2 weeks. We are running the CI pretty much daily, 2 weeks should be enough time to see if this re-occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working self-hosted
Projects
None yet
Development

No branches or pull requests

2 participants