[ZBX-12180] Server crashes when connecting to the IBM DB2 database Created: 2017 May 13 Updated: 2018 Oct 08 Resolved: 2018 Oct 08 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 3.2.6 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Minor |
Reporter: | Alexander Vladishev | Assignee: | Unassigned |
Resolution: | Unsupported version | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
Backtrace: 2094:20170513:125443.997 ====== Fatal information: ====== 2094:20170513:125443.997 Program counter: 0x7f098a8d45d5 ... 2094:20170513:125443.997 === Backtrace: === 2094:20170513:125443.998 12: sbin/zabbix_server(zbx_log_fatal_info+0x1b6) [0x4720b6] 2094:20170513:125443.998 11: sbin/zabbix_server() [0x47240c] 2094:20170513:125443.998 10: /lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7f098933dd40] 2094:20170513:125443.998 9: /opt/ibm/db2/V9.7/lib64/libdb2.so.1(_Z18SQLSetConnectAttr2P15CLI_CONNECTINFOiPvihP5sqlcaP19CLI_ERRORHEADERINFO+0x8c7) [0x7f098a8d45d5] 2094:20170513:125443.998 8: /opt/ibm/db2/V9.7/lib64/libdb2.so.1(SQLSetConnectAttr+0x338) [0x7f098a8e3afa] 2094:20170513:125443.998 7: sbin/zabbix_server(zbx_db_connect+0x250) [0x4c957e] 2094:20170513:125443.998 6: sbin/zabbix_server(DBconnect+0xbb) [0x4a4dad] 2094:20170513:125443.998 5: sbin/zabbix_server(zbx_db_get_database_type+0x24) [0x4a798a] 2094:20170513:125443.998 4: sbin/zabbix_server(MAIN_ZABBIX_ENTRY+0x3ed) [0x41a26b] 2094:20170513:125443.998 3: sbin/zabbix_server(daemon_start+0x2ee) [0x471b09] 2094:20170513:125443.998 2: sbin/zabbix_server(main+0x638) [0x419d29] 2094:20170513:125443.998 1: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f0989328ec5] 2094:20170513:125443.998 0: sbin/zabbix_server() [0x412a89] This crash is caused by this code, which has been added under src/libs/zbxdb/db.c:342 /* set codepage to utf-8 */ if (ZBX_DB_OK == ret && SUCCEED != zbx_ibm_db2_success(SQLSetConnectAttr(ibm_db2.hdbc, SQL_ATTR_CLIENT_CODEPAGE, (SQLPOINTER)(SQLUINTEGER)1208, SQL_IS_UINTEGER))) { ret = ZBX_DB_FAIL; } Removing this code allows to see a database connection error message: 20450:20170513:120539.722 [Z3001] connection to database 'szbxnext2031' failed: [-1001] HY501 [IBM][CLI Driver] SQL1001N "SZBXNEXT2031" is not a valid database name. SQLSTATE=2E000 20450:20170513:120539.722 Cannot connect to the database. Exiting... |
Comments |
Comment by Glebs Ivanovskis (Inactive) [ 2017 May 13 ] | ||||||||
IBM documentation for different versions has different examples regarding setting connection encoding. In 9.7.0: SQLINTEGER iUnicode = 1208; cliRC = SQLSetConnectAttr(hdbc, SQL_ATTR_CLIENT_CODEPAGE, (SQLPOINTER)iUnicode, SQL_IS_INTEGER); Starting from 10.1.0: Unicode = 1208; cliRC = SQLSetConnectAttr(hdbc, SQL_ATTR_CLIENT_CODEPAGE, (SQLPOINTER)&unicode, SQL_NTS); Description of function parameters (last two) is very vague, contradicts both examples and hasn't changed between versions:
| ||||||||
Comment by Glebs Ivanovskis (Inactive) [ 2017 May 13 ] | ||||||||
By the way, I saw the log, library tries to dereference address 4b816 = 120810. | ||||||||
Comment by Glebs Ivanovskis (Inactive) [ 2017 Jul 28 ] | ||||||||
(1) By the way, instead of 1208 we should probably use SQL_CP_UTF8. | ||||||||
Comment by Aigars Kadikis [ 2018 Oct 08 ] | ||||||||
Closing due to an unsupported version. |