SchedulesDirect / JSON-Service

Code related to download, slice-and-dice and generation of JSON into database.
36 stars 5 forks source link

Receive code 500 when adding lineup (but lineup added) #68

Open garybuhrmaster opened 8 years ago

garybuhrmaster commented 8 years ago

While testing some code to add/delete lineups, it may be that I have exceeded the number of allowed changes, but rather than returning an error (expected) it appears the the BIGINT UNSIGNED value of -1 causes difficulty (changedRemaining = -1? for an unsigned value?). Interestingly the lineup does get added.

Not the most important thing in the world, but server errors are never good....

HTTP response code: 500

HTTP Error message:

`Slim Application Error The application could not run because of the following error:

Details

Type: PDOException Code: 22003 Message: SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in \'(API20141201.user.changesRemaining - 1)\' File: /var/www/html/functions/func.20141201.php Line: 1313 Trace

0 /var/www/html/functions/func.20141201.php(1313): PDOStatement->execute(Array)

1 /var/www/html/functions/func.20141201.php(1976): heUpdateCounter(\'1417\')

2 /var/www/html/index.php(336): addLineupToUserAccount(\'1417\', \'USA-DITV-DEFAUL...\', 255)

3 [internal function]: {closure}(\'USA-DITV-DEFAUL...\')

4 /var/www/html/vendor/slim/slim/Slim/Route.php(468): call_user_func_array(Object(Closure), Array)

5 /var/www/html/vendor/slim/slim/Slim/Slim.php(1357): Slim\Route->dispatch()

6 /var/www/html/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()

7 /var/www/html/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()

8 /var/www/html/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

9 /var/www/html/vendor/slim/slim/Slim/Slim.php(1302): Slim\Middleware\PrettyExceptions->call()

10 /var/www/html/index.php(1011): Slim\Slim->run()

11 {main}`

rkulagowski commented 8 years ago

Weird - I thought I had already handled that, so I'm wondering where my code is letting it wrap around to negative. I'll investigate.

garybuhrmaster commented 8 years ago

Thanks. And sorry. No real hurry.

I think I was easily able to reproduce it. I was apparently getting it a few times, but as the return was 500 (server error) and my code auto-retries for server errors (and a number of other retryable errors such as timeouts), after the retry I was getting a "Add failed, duplicate" because while I was getting the 500, it was adding. I was pulling (what little remaining) hair out at first wondering what was going on (so I had to add in the debugging code to notice what seemed like the improbable).

Again, no hurry, and thanks for looking into it.