0

While running a pretty average operation, my application crashed with the error message:

[error] [exception.RedBean_Exception_SQL] [22003] - SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range in '(`zurmo`.`account_read`.`count` - 1)'

This error is perplexing me because it's similar to the error message from this question, but for a MUCH smaller value / character count. Even more perplexing is the fact that I KNOW that there are larger regular int values in the database.

Now, I can go into further detail about the application, but this doesn't appear to be an issue with the application or even the database interface (redbean), even though they're both tagged here.

For futher information, here is the stack trace:

REQUEST_URI=/app/index.php/zurmo/role/details?id=4
HTTP_REFERER=https://************/app/index.php/zurmo/role/details?id=4
---
2017/08/30 07:27:57 [warning] [application] Exception class: RedBean_Exception_SQL
#0 /var/www/html/redbean/rb.php(777): RedBean_Driver_PDO->runQuery('update account_...', Array)
#1 /var/www/html/redbean/rb.php(1779): RedBean_Driver_PDO->Execute('update account_...', Array)
#2 /var/www/html/redbean/rb.php(7534): RedBean_Adapter_DBAdapter->exec('update account_...', Array)
#3 /var/www/html/redbean/rb.php(7440): RedBean_Facade::query('exec', 'update account_...', Array)
#4 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(962): RedBean_Facade::exec('update account_...')
#5 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(1022): ReadPermissionsOptimizationUtil::decrementCount('account_read', 19716, Object(Role))
#6 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(1053): ReadPermissionsOptimizationUtil::decrementParentRolesCounts('account_read', 19716, Object(Role))
#7 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(668): ReadPermissionsOptimizationUtil::bulkDecrementParentRolesCounts('account_read', Array, Object(Role))
#8 /var/www/html/app/protected/modules/zurmo/utils/ReadPermissionsOptimizationUtil.php(604): ReadPermissionsOptimizationUtil::roleParentSetOrRemoved(false, Object(Role))
#9 /var/www/html/app/protected/modules/zurmo/utils/AllPermissionsOptimizationUtil.php(357): ReadPermissionsOptimizationUtil::roleParentBeingRemoved(Object(Role))
#10 /var/www/html/app/protected/modules/zurmo/models/Role.php(181): AllPermissionsOptimizationUtil::roleParentBeingRemoved(Object(Role))
#11 /var/www/html/app/protected/core/models/RedBeanModel.php(1909): Role->beforeSave()
#12 /var/www/html/app/protected/modules/zurmo/models/Item.php(123): RedBeanModel->save(false, NULL)
#13 /var/www/html/app/protected/modules/zurmo/utils/ZurmoControllerUtil.php(162): Item->save(false)
#14 /var/www/html/app/protected/modules/zurmo/utils/ZurmoControllerUtil.php(109): ZurmoControllerUtil->saveModelFromSanitizedData(Array, Object(Role), false, 'Philippines Des...', false)
#15 /var/www/html/app/protected/modules/zurmo/components/ZurmoBaseController.php(738): ZurmoControllerUtil->saveModelFromPost(Array, Object(Role), false, 'Philippines Des...', false)
#16 /var/www/html/app/protected/modules/zurmo/controllers/RoleController.php(99): ZurmoBaseController->attemptToSaveModelFromPost(Object(Role))
#17 /var/www/html/app/protected/modules/zurmo/controllers/RoleController.php(74): ZurmoRoleController->actionEdit('4')
#18 [internal function]: ZurmoRoleController->actionDetails('4')
#19 /var/www/html/yii/framework/web/actions/CAction.php(109): ReflectionMethod->invokeArgs(Object(ZurmoRoleController), Array)
#20 /var/www/html/yii/framework/web/actions/CInlineAction.php(47): CAction->runWithParamsInternal(Object(ZurmoRoleController), Object(ReflectionMethod), Array)
#21 /var/www/html/yii/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#22 /var/www/html/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(Object(CInlineAction))
#23 /var/www/html/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#24 /var/www/html/yii/framework/web/filters/CFilterChain.php(130): CFilter->filter(Object(CFilterChain))
#25 /var/www/html/yii/framework/web/CController.php(291): CFilterChain->run()
#26 /var/www/html/yii/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#27 /var/www/html/yii/framework/web/CWebApplication.php(286): CController->run('details')
#28 /var/www/html/yii/framework/web/CWebApplication.php(141): CWebApplication->runController('zurmo/role/deta...')
#29 /var/www/html/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#30 /var/www/html/app/protected/core/components/WebApplication.php(88): CApplication->run()
#31 /var/www/html/app/index.php(75): WebApplication->run()
#32 {main}

What can be done to resolve this? I feel like it's somehow related to the database's configuration, but I don't know what to look at for it.

bdb.jack
  • 147
  • 1
  • 8
  • Is it a result of SIGNED-UNSIGNED formula value types? Mysql may bork if that is the case and you don't explicitly typecast operands in a sql query. Try to print the query with values in a logfile to analyze it further. – Whome Aug 30 '17 at 05:14
  • @Whome Do you need the query itself? or other sets of information as well? – bdb.jack Aug 30 '17 at 06:48
  • I don't need a query it was just a hint maybe you should run an additional debug to pinpoint exact sql query and parameter value types being submitted (PreparedStatement, Statement, typed params, A+B+C column arithmetic?) – Whome Aug 30 '17 at 12:44
  • Keep in mind that for an Unsigned BigInt, -1 is out of range. It is common practice for PHP procedures to return -1 upon error, so it looks likely that your program is trying to save an error code as a record key. – Curt Apr 25 '18 at 17:40

1 Answers1

0

count may be a 'reserved' element.

SHOW CREATE TABLE table_name may have some details about the data types that are critical.

Search in SO for SQLSTATE 22003 and you will find many previous experiences and many with resolutions that resolved the error message.

Wilson Hauck
  • 2,094
  • 1
  • 11
  • 19