1

I'm running php artisan queue:work --tries=3 on some mail jobs but I keep getting this error in the log file:

[2018-11-02 03:22:02] local.ERROR: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: updatejobssetreserved_at= 1541128922,attempts= 256 whereid= 767) {"exception":"[object] (Illuminate\\Database\\QueryException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: updatejobssetreserved_at= 1541128922,attempts= 256 whereid= 767) at /var/www/html/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 at /var/www/html/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:144, PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 at /var/www/html/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:142) [stacktrace]

The job is actually being created in the jobs table but it isn't being processed. How can I resolve this issue?

andromeda
  • 4,433
  • 5
  • 32
  • 42
  • Whats this database error `SQLSTATE[22003] Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1` Probably your field is to small to hold the data or your putting a signed INT into an Unsigned field. Such as setting a negative value in an unsigned field. – ArtisticPhoenix Nov 02 '18 at 05:33
  • Have you created the `failed_jobs` table as shown in the docs? https://laravel.com/docs/5.7/queues#dealing-with-failed-jobs – Travis Britz Nov 03 '18 at 11:07
  • @TravisBritz Yes I did, there are no entries in it. – andromeda Nov 03 '18 at 14:05
  • Are you sure the workers are running with the `--tries=3` option, and none of the jobs have a `$tries` property greater than 255 or a `retryUntil()` method defined on the class? – Travis Britz Nov 03 '18 at 14:12

2 Answers2

0

Please increase attempts field data value

  • 1
    Care to elaborate further on this? – andromeda Nov 02 '18 at 05:09
  • @andromeda: Because ```attemps``` datatype value(size) is less than your input value size *OR* please check this [Link](https://stackoverflow.com/questions/14284494/mysql-error-1264-out-of-range-value-for-column) for more details. –  Nov 02 '18 at 05:18
  • Please add some explanation why you think that this solves the problem, and please do so by editing the answer, not by putting a link into the comment section – Nico Haase Nov 02 '18 at 07:10
0

SQLSTATE[22003] Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1

IT looks like your attemets field is set to TINYINT max of 255, I can tell because of this bit.

 SQL: updatejobssetreserved_at= 1541128922,attempts= 256 whereid= 767

And because I know that a TinyInt can hold 255 (because I just googled it..ha ha). Its actually probably defined as INT(1) UNSIGEND

So you want to change that to > TINYINT LIKE a NOTSOTINYINT.... :) I mean SMALLINT

PS I cheated

https://dev.mysql.com/doc/refman/5.5/en/integer-types.html

ArtisticPhoenix
  • 21,464
  • 2
  • 24
  • 38