Skip to content

I get Intermittent hangs of up to 10 minutes when connecting to DB2 server. #1073

Description

@stonepd
  • Operating System Name:
$ cat /etc/*release
NAME="Red Hat Enterprise Linux"
VERSION="9.8 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.8"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.8 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://issues.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.8
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.8"
Red Hat Enterprise Linux release 9.8 (Plow)
Red Hat Enterprise Linux release 9.8 (Plow)
  • db2level output from clidriver if in use:
$ ./db2level 
DB21085I  This instance or install (instance name, where applicable: "*") uses 
"64" bits and DB2 code release "SQL11059" with level identifier "060A010F".
Informational tokens are "DB2 v11.5.9.0", "special_50315", 
"DYN2410311831AMD64_50315", and Fix Pack "0".
Product is installed at "..".
  • Target Db2 Server Version:
IBM Db2 operator installed in Openshift

Operator CSV: db2u-operator.v120104.0.0
DB2 Cluster CR 
status:
  version: s12.1.4.0
  • Python Version:
$ python3 --version
Python 3.12.13
  • ibm_db version:
$ pip3 list
...
ibm_db                       3.2.8
  • For non-Windows, output of below commands:
    uname
    uname -m
$ uname
Linux
sh-5.1$   uname -m
x86_64
sh-5.1$   uname -a
Linux credential-entitymgr-jdbccfg-5bbdb9df5d-j5krh 5.14.0-570.122.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 12 06:17:09 EDT 2026 x86_64 x86_64 x86_64 GNU/Linux
  • Value of below environment variables if set:
    IBM_DB_HOME:
    PATH:
    LIB/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH:
sh-5.1$ echo $IBM_DB_HOME

$ echo $PATH
/opt/ansible/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
sh-5.1$ echo $LIB

sh-5.1$ echo $LD_LIBRARY_PATH
/lib64:/usr/lib64:/usr/local/lib:/opt/ansible/lib:
sh-5.1$ echo $DYLD_LIBRARY_PATH

sh-5.1$
  • Test script to reproduce the problem.
The connection has been running as part on an ansible playbook/task

Eventually through debugging I was able to reproduce the hang using the DB2 CLI

cd /usr/local/lib64/python3.12/site-packages/clidriver/bin
./db2cli execsql -connstring "DATABASE=BLUDB;HOSTNAME=c-mas-credential-main-manage-db2u-engn-svc.db2u.svc;PORT=50001;PROTOCOL=TCPIP;UID=db2inst1;PWD=XXXXXXX;SECURITY=ssl;SSLServerCertificate=/tmp/jdbc.pem;"
…

Sometimes this completes instantly, sometimes it hangs for around 10 minutes

**

**

  1. Can be reproduced using the DB2CLI command above, sometimes this completes instantly, sometimes it hangs for around 10 minutes

Observations and diagnostics
The process is taking 100% CPU during the hang, it’s not just idle.

I saw similar issues reported here

#946
#763
#630

So I ran db2trc and see a lot of time spent in SQLDriverConnectW and cryptDHInit, cryptContextRealInit:

$ ./db2trc on -perfcount -t
$ ./db2trc dmp /tmp/perf.dmp
$ ./db2trc perffmt /tmp/perf.dmp /tmp/perf.fmt
$ sort -k 2 /tmp/perf.fmt

     1         11.288255000 sqljrLookupAddressAndConnect
     2         17.446558000 sqljrDrdaArAuthenticate
     1        341.828108000 cryptContextRealInit
     1        341.828131000 cryptDHInit
     1        345.503134000 sqlexSlcServerEncryptAccsec
     2        345.503246000 sqlexSlcServerEncryptAuthenticate
     1        362.950027000 sqlexAppAuthenticate
     1        362.950299000 sqljrDrdaArConnect
     1        362.950324000 sqleUCdrdaARinit
     1        362.969425000 sqleUCappConnect
     1        362.970356000 CLI_sqlConnect
     1        362.970449000 CLI_sqlConnect
     1        362.970670000 SQLConnect2
     1        362.970684000 SQLConnect2
     1        362.971202000 SQLDriverConnect2
     1        362.971215000 SQLDriverConnect2
     1        362.971380000 SQLDriverConnectW
     1        362.971440000 SQLDriverConnectW

see the attached perf.dmp and perf.out files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions