xuan1118's avatar

xuan1118 wrote a reply+100 XP

5mos ago

public function handle() { $job = 'Job:' . $this->job->getJobId(); Log::info("{$job} start");

try {
    $sql = "WAITFOR DELAY '00:00:30'; SELECT 1 as result";

    DB::purge('sqlsrv');

    DB::reconnect('lswldb')->select($sql);

    Log::info("{$job} end");

} catch (\Exception $e) {
    Log::error("{$job} Exception", [
        'exception' => get_class($e),
        'message'   => $e->getMessage(),
        'code'      => $e->getCode()
    ]);

    throw $e;
}

}

Adjusted the handle() method, but the issue still persists. It throws: SQLSTATE[08S01]: [Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x2714 (Connection: sqlsrv, SQL: WAITFOR DELAY '00:00:30'; SELECT 1 as result)

In sqlsrv, the parameter 'persistent' => false should be ineffective.

xuan1118's avatar

xuan1118 started a new conversation+100 XP

5mos ago

Horizon Version
5.40.1

Laravel Version
11.46.1 | 12.10.1

PHP Version
8.4.14

Redis Driver
PhpRedis

Redis Version
phpRedis 6.3.0

Database Driver & Version
pdo_sqlsrv 5.12.0, ODBC Driver 18 for SQL Server 18.5.1.1

Description

'supervisor-1' => [
    'connection' => 'redis',
    'queue' => ['default'],
    'balance' => 'auto',
    'autoScalingStrategy' => 'time',
    'maxProcesses' => 10,
    'maxTime' => 0,
    'maxJobs' => 0,
    'memory' => 128,
    'balanceMaxShift' => 1,
    'balanceCooldown' => 3,
    'tries' => 1,
    'timeout' => 60,
    'nice' => 0,
],

When new processes are created, failed tasks are consistently triggered, throwing the following exception:
SQLSTATE[08S01]: [Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x2714 (Connection: sqlsrv, SQL: WAITFOR DELAY '00:00:30'; SELECT 1 as result)

Steps To Reproduce

Add the following to web routes:

Route::get('/test-08S01', function () {
    \App\Jobs\Test08S01Exception1Job::dispatch();
    return "successfully";
});

The exception occurs when tasks are processed concurrently.