PB 的 error.number 列表

本文列举了PowerBuilder中的各种错误代码及其对应的错误信息说明,从被0除的错误到各种类型的对象和函数调用错误等,共计89条。这些错误代码有助于开发者定位并解决问题。
这是 PB 的 error.number 列表
有待继续补充


string  ls_msg
choose case error.number
 case 1//by zero
  ls_msg = "发生被 0 除错误"
 case 2//2 Null object reference 
  ls_msg = "空对象引用"
 case 3//3 Array boundary exceeded 
  ls_msg = "数组越界"
 case 4//4 Enumerated value is out of range for function 
  ls_msg = "枚举值超出函数的范围"
 case 5//5 Negative value encountered in function 
  ls_msg = "函数中遇到负数"
 case 6//6 Invalid DataWindow row/column specified 
  ls_msg = "数据窗口的列或行非法"
 case 7//7 Unresolvable external when linking reference 
  ls_msg = "链接调用时不能解决外部对象"
 case 8//8 Reference of array with null subscript 
  ls_msg = "使用空下标引用数组"
 case 9//9 DLL function not found in current application 
  ls_msg = "当前应用中没有找到动态链接库的函数"
 case 10//10 Unsupported argument type in DLL function 
  ls_msg = "使用了动态链接库函数不支持的参数类型"
 case 11//11 Object file is out of date and must be converted to current version 
  ls_msg = "对象文件已经过时并且必须使用当前的版本"
 case 12//12 DataWindow column type does not match GetItem type 
  ls_msg = "数据窗口的列的数据类型与GetItem函数的类型不符"
 case 13//13 Unresolved property reference 
  ls_msg = "属性引用尚未解决"
 case 14//14 Error opening DLL library for external function 
  ls_msg = "为外部函数调用而打开动态链接库时发生错误" 
 case 15//15 Error calling external function name 
  ls_msg = "调用外部函数时发生错误" 
 case 16//16 Maximum string size exceeded 
  ls_msg = "字符串长度超越了最大限制"
 case 17//17 DataWindow referenced in DataWindow object does not exist 
  ls_msg = "数据窗口引用的数据窗口对象不存在" 
 case 18//18 Function doesn't return value 
  ls_msg = "函数没有返回值(应该有而没有)" 
 case 19//19 Cannot convert name in Any variable to name 
  ls_msg = "不能转换Any类型的变量到另一个类型" 
 case 20//20 Database command has not been successfully prepared 
  ls_msg = "数据库命令没有成功准备" 
 case 21//21 Bad runtime function reference 
  ls_msg = "引用了错误的运行时函数" 
 case 22//22 Unknown object type 
  ls_msg = "不知道的对象类型" 
 case 23//23 Cannot assign object of type name to variable of type name 
  ls_msg = "不能将对象赋给变量,两种类型不能赋值" 
 case 24//24 Function call doesn't match its definition 
  ls_msg = "函数调用格式与其定义不一致" 
 case 25//25 Double or Real expression has overflowed 
  ls_msg = "双精度型或实型表达式溢出" 
 case 26//26 Field name assignment not supported 
  ls_msg = "不支持这种字段赋值" 
 case 27//27 Cannot take a negative to a noninteger power 
  ls_msg = "不能计算一个负数的非整数次方" 
 case 28//28 VBX Error: name 
  ls_msg = "VBX 错误" 
 case 29//29 Nonarray expected in ANY variable 
  ls_msg = "ANY 类型变量期待非数组类型" 
 case 30//30 External object does not support data type name 
  ls_msg = "外部对象不支持这种变量类型" 
 case 31//31 External object data type name not supported 
  ls_msg = "外部对象的数据类型不支持" 
 case 32//32 Name not found calling external object function name 
  ls_msg = "调用外部对象函数时函数名称没有找到" 
 case 33//33 Invalid parameter type calling external object function name 
  ls_msg = "调用外部对象函数时使用了错误的参数类型" 
 case 34//34 Incorrect number of parameters calling external object function name 
  ls_msg = "调用外部对象函数时使用的参数个数不对" 
 case 35//35 Error calling external object function name 
  ls_msg = "调用外部对象的函数错误" 
 case 36//36 Name not found accessing external object property name 
  ls_msg = "访问外部对象属性时属性名称没有找到" 
 case 37//37 Type mismatch accessing external object property name 
  ls_msg = "访问外部对象属性时使用了不匹配的类型" 
 case 38//38 Incorrect number of subscripts accessing external object property name 
  ls_msg = "访问外部对象属性时使用了错误的下标" 
 case 39//39 Error accessing external object property name 
  ls_msg = "访问外部对象的属性错误" 
 case 40//40 Mismatched ANY data types in expression 
  ls_msg = "表达式中ANY数据类型不匹配" 
 case 41//41 Illegal ANY data type in expression 
  ls_msg = "表达式中使用了非法的ANY数据类型" 
 case 42//42 Specified argument type differs from required argument type at runtime in DLL function name 
  ls_msg = "指定的参数类型与动态链接库中的函数所需要的参数类型不一致" 
 case 43//43 Parent object doesn't exist 
  ls_msg = "父对象不存在" 
 case 44//44 Function has conflicting argument or return type in ancestor
  ls_msg = "函数与祖先的参数或返回值冲突"  
 case 45//45 Internal table overflow; maximum number of objects exceeded 
  ls_msg = "内部表溢出;对象的最大数目已经超越" 
 case 46//46 Null object reference cannot be assigned or passed to a variable of this type 
  ls_msg = "空对象引用不能赋值或传递给一个这种类型的变量" 
 case 47//47 Array expected in ANY variable 
  ls_msg = "ANY类型期待数组" 
 case 48//48 Size mismatch in array to object conversion 
  ls_msg = "将数组转换成对象时数组的大小不匹配" 
 case 49//49 Type mismatch in array to object conversion 
  ls_msg = "将数组转换成对象不匹配" 
 case 50//50 Distributed Service Error 
  ls_msg = "分布式服务错误" 
 case 51//51 Bad argument list for function/event 
  ls_msg = "函数/事件的参数列表错误" 
 case 52//52 Distributed Communications Error 
  ls_msg = "分布式通讯错误" 
 case 53//53 Requested server not active 
  ls_msg = "被请求的服务器没有激活" 
 case 54//54 Server not accepting requests 
  ls_msg = "服务器不接受请求" 
 case 55//55 Request terminated abnormally 
  ls_msg = "请求意外中断" 
 case 56//56 Response to request incomplete 
  ls_msg = "响应请求不完整" 
 case 57//57 Not connected 
  ls_msg = "没有连接" 
 case 58//58 Object instance does not exist 
  ls_msg = "对象实例不存在" 
 case 59//59 Invalid column range 
  ls_msg = "无效的列的范围" 
 case 60//60 Invalid row range 
  ls_msg = "无效的行的范围" 
 case 61//61 Invalid conversion of number dimensional array to object 
  ls_msg = "转换多维数组到一个对象无效" 
 case 62//62 Server busy 
  ls_msg = "服务器忙" 
 case 63//63 Function/event with no return value used in expression 
  ls_msg = "在表达式中函数/事件没有返回值" 
 case 64//64 Object array expected in left side of assignment 
  ls_msg = "赋值语句左边期待对象数组" 
 case 65//65 Dynamic function not found. Possible causes include: pass by value/reference mismatch 
  ls_msg = "动态函数没有找到,可能是因为:值传递/引用传递不匹配" 
 case 66//66 Invalid subscript for array index operation 
  ls_msg = "属组索引使用了非法的下标" 
 case 67//67 NULL object reference cannot be assigned or passed to an autoinstantiate 
  ls_msg = "空的对象引用不能赋值或传递给一个自动实例化对象" 
 case 68//68 NULL object reference cannot be passed to external DLL function name 
  ls_msg = "空的对象引用不能传递给外部动态链接库函数" 
 case 69//69 Function name cannot be called from a secured runtime session 
  ls_msg = "安全模式中不能调用该函数" 
 case 70//70 External DLL function name cannot be called from a secured runtime session 
  ls_msg = "安全模式中不能调用外部动态链接库函数" 
 case 71//71 General protection fault occurred 
  ls_msg = "发生一般的保护错误" 
 case 72//72 name failed with an operating system error code of number 
  ls_msg = "字段发生一个操作系统错误" 
 case 73//73 Reference parameters cannot be passed to an asynchronous shared/remote object method 
  ls_msg = "引用型参数不能传递给一个异步的共享/远程对象方法" 
 case 74//74 Reference parameters cannot be passed to a shared object method 
  ls_msg = "引用型参数不能传递给一个共享对象的方法" 
 case 75//75 The server has forced the client to disconnect 
  ls_msg = "服务器已经强制客户端断开连接" 
 case 76//76 Passing NULL as a parameter to external function name 
  ls_msg = "给外部函数传递了一个空值参数" 
 case 77//77 Object passed to shared/remote object method is not a nonvisual user object 
  ls_msg = "对象传递给共享/远程对象的方法不是一个不可视的用户对象" 
 case 78//78 Listen can only be done in Enterprise version of PowerBuilder 
  ls_msg = "监听只能在企业版的PowerBuilder中使用" 
 case 79//79 The argument to name must be an array 
  ls_msg = "参数必须是一个数组" 
 case 80//80 The server has timed out the client connection 
  ls_msg = "客户端尝试连接的时间已经超出服务器设置的限制时间" 
 case 81//81 Function argument file creator must be a four character string 
  ls_msg = "函数参数文件创建者必须是一个四个字符的字符串" 
 case 82//82 Function argument file type must be a four character string 
  ls_msg = "函数参数文件类型必须是一个四个字符的字符串" 
 case 83//83 Attempt to invoke a function or event that is not accessible 
  ls_msg = "试图调用一个不可存取的函数或事件" 
 case 84//84 Wrong number of arguments passed to function/event call 
  ls_msg = "在函数/事件中传递的参数个数错误" 
 case 85//85 Error in reference argument passed in function/event call 
  ls_msg = "在函数/事件中传递的引用型参数错误" 
 case 86//86 Ambiguous function/event reference 
  ls_msg = "引用不明确的函数/事件" 
 case 87//87 The connection to the server has been lost 
  ls_msg = "与服务器的连接已经丢失" 
 case 88//88 Cannot ask for ClassDefinition Information on open painter: name 
  ls_msg = "不能在打开的画笔中查询类定义信息" 
 case 85//89 5.0 style proxy objects are not supported. Copy the new style proxy that was generated at migration time 
  ls_msg = "5.0中的类型代理对象不支持,拷贝移植时产生的新的类型代理" 
 case 90//90 Cannot assign array of type name to variable of type array of name 
  ls_msg = "这两种数据类型的数组不能赋值"
 case 91//91 Cannot convert any in Any variable to string.Possible cause uninitialized value.
  ls_msg = "不能将任意型变量转变成字符型变量"
 case else
  ls_msg = '未知错误, 请记录错误号并与管理员联系'
end choose
 
 
在你提供的 Go 代码中,`KILL <id>` 是用于终止 MySQL 中某个连接会话(线程)的命令。你问的是: > **什么样的 MySQL 会话 ID 才会导致超时?** 我们先分析代码逻辑,再回答这个问题。 --- ### ✅ 代码解析 ```go killSQL := fmt.Sprintf("KILL %d;", id) if _, err := sqlDB.ExecContext(timeoutCtx, killSQL); err != nil { // 记录失败结果 killResults = append(killResults, &pb.MySQLKillResult{...}) continue } ``` 这里使用了 `sqlDB.ExecContext(timeoutCtx, ...)`,意味着执行 `KILL` 命令时受到 `timeoutCtx` 的限制 —— 如果在这个上下文超时前没有完成操作,就会返回 `context deadline exceeded` 错误。 但关键点在于:**`KILL` 命令本身是发给 MySQL 服务器的,它的“执行时间”通常极短**,因为它是通知 MySQL 去中断另一个连接。所以正常情况下不会超时。 --- ### ❓ 那么什么情况下 `KILL` 会超时? 虽然 `KILL` 指令本身很快,但在某些特殊场景下,MySQL 处理 `KILL` 请求可能会被阻塞,从而导致客户端等待并最终超时。 以下是可能导致 `KILL` 超时的几种典型情况: --- #### 1. **目标会话正在执行不可中断的操作** 某些长时间运行、且不能立即响应中断的操作,在收到 `KILL` 后并不会立刻终止,而是需要等到当前操作可以安全退出时才结束。 常见例子包括: - 正在做 **InnoDB 回滚事务(UNDO)** - 正在执行 **大事务的清理** - 正在进行 **表空间导入/导出** - 等待磁盘 I/O 或锁(如行锁、元数据锁)无法释放 👉 这些操作会让线程处于“已标记为 killed,但尚未退出”的状态(`Command=Killed`),而此时你的 `KILL` 命令虽然已被 MySQL 接受,但它可能要等很久才能真正“完成”,进而造成客户端感知为“卡住”。 ⚠️ 注意:`KILL` 命令发送成功 ≠ 目标连接立即断开。 --- #### 2. **MySQL 主库负载过高或网络延迟大** 如果 MySQL 实例 CPU 使用率极高、连接数过多、IO 拥塞,即使是简单的 `KILL` 操作也可能排队处理,导致响应延迟超过 `timeoutCtx` 设定的时间(比如 `executeOverTime` 设置为 5 秒)。 --- #### 3. **目标会话处于“僵死”或“未响应”状态** 有时客户端连接已经断开,但 MySQL 没有及时检测到(TCP keepalive 未触发),该线程仍存在于 `information_schema.processlist` 中。这种“僵尸连接”即使执行 `KILL` 也无法唤醒或清理,系统层面处理缓慢,也可能拖慢整体响应。 --- #### 4. **MySQL 内部锁竞争严重** 例如,多个线程同时访问线程列表或资源管理器时发生互斥锁争抢,`KILL` 操作本身被阻塞。 --- #### 5. **使用了 `KILL QUERY` vs `KILL CONNECTION` 的区别** 你的代码是 `KILL <id>`,这等价于 `KILL CONNECTION <id>`,它会终止整个连接。 但如果目标连接正在执行一个非常复杂的查询(如嵌套子查询、join 大表),即使连接被杀,其资源释放过程(回滚、清理 tmp table 等)仍需时间,期间 `ExecContext` 可能已超时。 --- ### 🔍 如何判断是否真的“超时”? 你可以检查错误类型: ```go if err != nil { if errors.Is(err, context.DeadlineExceeded) { // 明确是超时了 log.Printf("KILL %d timed out after %ds", id, executeOverTime) } else { // 其他错误,比如权限不足、连接断开等 } } ``` 如果是 `context deadline exceeded`,说明命令没能在规定时间内完成,很可能是因为上述原因之一。 --- ### ✅ 最佳实践建议 1. **适当增加 `executeOverTime` 时间**(如从 5s 改为 10~30s),尤其是预期目标会话可能正在进行回滚。 2. **监控目标线程的状态**:通过 `SHOW PROCESSLIST` 或 `information_schema.processlist` 查看线程的 `State` 和 `Command`。 3. **避免频繁批量 `KILL`**:一次杀太多连接可能导致 MySQL 短暂卡顿。 4. **考虑异步处理 `KILL` 操作**:不要阻塞主流程,允许后台慢慢清理。 5. **使用 `pt-kill` 工具辅助管理长查询**(Percona Toolkit) --- ### 🧩 示例:查看哪些线程难以被 kill ```sql SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM information_schema.processlist WHERE COMMAND != 'Sleep'; ``` 重点关注: - `TIME` 很大 - `STATE` 是 `updating`, `copying to tmp table`, `reading from net` 等 - `COMMAND = Query` 且长时间不结束 这些都可能是 `KILL` 后仍难以退出的候选者。 --- ### ✅ 总结 > **什么样的 MySQL 会话 ID 会导致 `KILL` 超时?** 答:那些**正在执行不可中断操作**(如事务回滚、大查询清理)、**系统资源紧张**、或**本身已处于异常状态**的会话 ID,会导致 `KILL` 命令虽被接受但无法快速完成,从而使客户端因上下文超时而报错。 这类会话的特点通常是: - 运行时间长 - 占用大量 undo log(回滚段) - 处于非睡眠状态且持有锁 - `State` 显示为“Killed”但仍存在 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值