/
SQL STATE ERROR FIX:

SQL STATE ERROR FIX:

The following approaches were taken to fix SQL State Error 08S01 (JDBC Connection Error: Communication link failure):

  • Increase connection pool size (hibernate. config)

  • Check thoroughly if the connection where we are getting data from db is closed or not

  • Update app-engine service config instance to automatic (F41G)

runtime: java8 api_version: user_defined env: standard threadsafe: true instance_class: F4_1G inbound_services: - warmup handlers: - url: (/.*) static_files: __static__\1 require_matching_file: true upload: __NOT_USED__ - url: / script: unused - url: .*\.jsp script: unused - url: /.*/ script: unused - url: /_ah/.* script: unused env_variables: ENDPOINTS_SERVICE_NAME: order-return-dot-eshopbox-client-portal-prod.appspot.com GAE_PROFILER_MODE: 'cpu,heap' HEAP_SIZE_RATIO: '90' JAVA_GC_OPTS: '-XX:+UseG1GC -XX:+UseStringDeduplication' JAVA_OPTS: '-XX:-OmitStackTraceInFastThrow' automatic_scaling: min_idle_instances: 2 max_idle_instances: 2 min_pending_latency: automatic max_pending_latency: 15s max_concurrent_requests: 70 target_cpu_utilization: 0.9 min_instances: 4 max_instances: 10 network: name: default vpc_access_connector: name: >- projects/eshopbox-client-portal-prod/locations/asia-south1/connectors/redis-connector-cp egress_setting: private-ip-ranges service_account: eshopbox-client-portal-prod@appspot.gserviceaccount.com
  • Change config to c3p0:

<property name="hibernate.c3p0.min_size">1</property> <property name="hibernate.c3p0.max_size">70</property> <property name="hibernate.c3p0.timeout">0</property> <property name="hibernate.c3p0.max_statements">30</property> <property name="hibernate.c3p0.maxConnectionAge">180</property>
  • Update and check the query (log where SQL State Error occurs)

  • Increase database timeout time

  • Enable the 'autoReconnect=true' property in your JDBC connection

  • the 'wait_timeout' setting has increased (36000) 'eshopbox-wms-production' DB instance and its replicas.

  • hibernate.c3p0.maxConnectionAge or the hibernate.c3p0.timeout is below 300 seconds

  • <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId> <version>6.1.6.Final</version> <type>pom</type> </dependency>

    pom.xml add <type>pom</type>

  • Additionally, Google team asked to add following

    <property name="hibernate.c3p0.unreturnedConnectionTimeout">30</property> <property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property>

 

Add label

Related content