Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Ucj-0006aC-9v for pgsql-general@arkaria.postgresql.org; Mon, 25 Mar 2019 18:47:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h8Uch-0000xx-W7 for pgsql-general@arkaria.postgresql.org; Mon, 25 Mar 2019 18:47:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Uch-0000oE-3U for pgsql-general@lists.postgresql.org; Mon, 25 Mar 2019 18:47:03 +0000 Received: from sonic317-26.consmr.mail.bf2.yahoo.com ([74.6.129.81]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8Ucd-0000rG-6T for pgsql-general@lists.postgresql.org; Mon, 25 Mar 2019 18:47:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1553539617; bh=uLJ7Fx51yw732gDp7RVuUiMZOWvVT/mH0O+Gfe08cwM=; h=Date:From:To:Subject:References:From:Subject; b=ioOYJPvZujT99UFro1pfaLaSL8I15NzC4Qt6Kx0ttvMjb5liP9plr6BGuix4rLaFGIrQAMov78cof9RBfSHEwjt+ZeA1/hdXIRla3Mx+/ersBlwZtEfawMxYmuCP42NJVJjAJqvTfh0eSJ4EcHp4fnuD7mBc6GxrEljbLIeaxpOpi/i7UFiZCsd39ut2kKIq4CQpwi//c2y2yUZmTznmT9qsglm4xit+FZfNnSly/Py24mCCC/qhQbIJ8sRYMq4DLlrY4qRg7SVToeKRuFwDJX9dxXvfQqGaBScwI18nsT2L2rB0mJT4GWsNtSZN78udDiQwlGTYH0DIBikJ1731Iw== X-YMail-OSG: XuSrun8VM1lSDqrYoRehYaFZ_985f9D0fkZY6rfjzo0AD6PGfCCRZSZGI_Ji_mw EzwlMbfqijOO1dtT5hTeXIEG0HUOpd_WP3NLmhjmShE_TznSEUAb3F9Xe7S.qmFG_8.LEtAe.8LD jL59Fl5FKE5I4T2GZheIoBD1YnT9uppf5rPCVbQ9K_SRS8rbL.xHfvdRorqS.niRpTUODnjiEmrZ wJrP5yLhK0PG9fD_lAjthojqDXIlogD62QKT6VFyV2aLo_R29WgP9wPlnfdS0qaJS_UQkPmvHbs1 EqKREcbCf4yUIVhNsDqBmu3akr_23JwC3CekJBTjX.uIYAGFPXIbGteYSEMLJZT4XaLAUM1ocPWR rfVS0d8mdvZ3o0_tcevIwyet3u9NWwUcBlCt_9LPSdvpKXghkwEe75GFL7KfcBAZwsIOl8_hiMHc m2idZ9Jp3KdjdzAXegQ9Hg03yxvIh4AySG7Fe3WwCI6rvH4gwATCA3huO2.kv6UhkQUadkbIGyiu nkgAZwSGZ3lKipoYh8mNdCAasSBzYc9tfrhtzU3BqK5mJEfv_6WBmohK4fz.pY4zeyhcY1loVgqu GOF4KuvCysNhi9kdtXF7zsQ6ice5bWoGu9hTvzhl8gQCsTQ3q0abZTHBmwgTWcgRJGrfCaxbujHP lWFZOPWyAlpxeirWtgrEN9Se0.Oj_PEetQtRlK.bXvkqNb0pX3uvtZ3qUzP_pN7KofPBK5zKE7y4 X_HEXu35GpGLys0vzw2s0Tcj_2c0Miq2xpEbOCBlpQDNnwZ3ogAKQYgBjRyYUx7j1RI1NuEOUgKh G9b4885IAbv.BfukbKmCutxzqlwwTgw4qU3kgnG3mw347S7ihgxbTzcybSAnCmjBg1Fra0yPU.eR gtlQGGOu3TSKDBuy6b2TF1vfNdUz7DGr4eNizCeh2ZIS_nRcDICZF3hSLiiRCIsyVdSN453rqjVK c86pIvl25dgZFYAVMYkF5S7jIMXhwMH0EsBorIWAfAIQSdn5EsAaI0468zzgi7H5RrvXx0UBS9aG W141ry3DADL9w2iYXigbnZOjxM6kLpgF.MTuCT2__QP_GPzyBkL9H1c87fAxpniqY07SxrtYgnBl wi5TuhOGBTfECXO1ESWtVpIsIXDvVAGn0JQA- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.bf2.yahoo.com with HTTP; Mon, 25 Mar 2019 18:46:57 +0000 Date: Mon, 25 Mar 2019 18:46:17 +0000 (UTC) From: Thomas Tignor To: "pgsql-general@lists.postgresql.org" Message-ID: <1080815989.10741938.1553539577631@mail.yahoo.com> Subject: postgres 9.5 DB corruption: invalid byte sequence for encoding "UTF8" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_10741937_1099546592.1553539577629" References: <1080815989.10741938.1553539577631.ref@mail.yahoo.com> X-Mailer: WebService/1.1.13212 YMailNorrin Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36 Content-Length: 29462 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_10741937_1099546592.1553539577629 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hoping someone may be able to offer some guidance on this recurring problem= . I am providing this "problem report" to the general list as I understand = the bugs list requires a set of reproduction steps we do not yet have. Plea= se advise if I have the process wrong. I have tried to provide all known re= levant info here. Thanks in advance for any insights.--> A description of w= hat you are trying to achieve and what results you expect.: We are experiencing intermittent DB corruption in postgres 9.5.14. We are t= rying to identify and eliminate all sources. We are using two independent s= ervices for data replication, Slony-I v2.2.6 and a custom service developed= in-house. Both are based on COPY operations. DB corruption is observed whe= n COPY operations fail with an error of the form: 'invalid byte sequence fo= r encoding "UTF8"'. This occurs with a frequency ranging between a few days= and several weeks. Each incident is followed by a race to find and repair = or remove corrupted data, which we are getting good at. With well over a do= zen incidents, the great majority originally showed corruption in a single = VARCHAR(2000) column (value) in a single table (alert_attribute). In this t= ime, we read about suspected and real problems with TOAST functionality and= so made the decision to change alert_attribute.value to PLAIN storage. Sin= ce that change was made, most new incidents show corruption in the alert_at= tribute.name column instead (VARCHAR(200)). Another table (alert_instance) = has been impacted as well. See below for their schemas. We have looked high and low through system logs and device reporting utilit= y output for any sign of hardware failures. We haven't turned up anything y= et. We also tried rebuilding an entire DB from scratch. That did not seem t= o help. We have not been performing routine reindexing. This is a problem we are wo= rking to correct. Normally our master DB serves for an 8-12 week period wit= hout reindexing before we failover to a peer. Before assuming the master ro= le, the peer always begins by truncating the alert_instance and alert_attri= bute tables and loading all data from the current master. Hardware specs are listed below. For storage, we have 8 INTEL SSDSA2BW12 di= rect-attached disks. We can provide additional info as needed. ams=3D# \d ams.alert_attribute Table "ams.alert_attribute" Column | Type | Modifiers=20 -------------------+-------------------------+----------- alert_instance_id | integer | not null name | character varying(200) | not null data_type | smallint | not null value | character varying(2000) |=20 Indexes: "pk_alert_attributes" PRIMARY KEY, btree (alert_instance_id, name), tab= lespace "tbls5" "idx_aa_aval" btree (name, value) Foreign-key constraints: "fk_alert_attr_instance_id" FOREIGN KEY (alert_instance_id) REFERENCES = ams.alert_instance(alert_instance_id) ON DELETE CASCADE Triggers: _ams_cluster_logtrigger AFTER INSERT OR DELETE OR UPDATE ON ams.alert_a= ttribute FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.logtrigger('_ams_clust= er', '2', 'kk') _ams_cluster_truncatetrigger BEFORE TRUNCATE ON ams.alert_attribute FOR= EACH STATEMENT EXECUTE PROCEDURE _ams_cluster.log_truncate('2') Disabled user triggers: _ams_cluster_denyaccess BEFORE INSERT OR DELETE OR UPDATE ON ams.alert_= attribute FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.denyaccess('_ams_clus= ter') _ams_cluster_truncatedeny BEFORE TRUNCATE ON ams.alert_attribute FOR EA= CH STATEMENT EXECUTE PROCEDURE _ams_cluster.deny_truncate() ams=3D#=20 ams=3D# \d ams.alert_instance=20 Table "ams.alert_instance" Column | Type | Modifiers=20 ---------------------+--------------------------------+----------- alert_instance_id | integer | not null alert_definition_id | integer | not null alert_instance_key | character varying(500) | not null start_active_date | timestamp(0) without time zone | not null stop_active_date | timestamp(0) without time zone |=20 active | smallint | not null acknowledged | smallint | not null ack_clear_time | timestamp(0) without time zone |=20 user_set_clear_time | smallint |=20 category_id | integer | not null condition_start | timestamp(0) without time zone | not null unack_reason | character varying(1) |=20 viewer_visible | smallint | not null Indexes: "pk_alert_instance" PRIMARY KEY, btree (alert_instance_id), tablespace = "tbls5" "idx_alert_inst_1" btree (alert_instance_key, alert_definition_id, aler= t_instance_id, active, acknowledged, ack_clear_time), tablespace "tbls5" "idx_alert_inst_cat_id" btree (category_id), tablespace "tbls5" "idx_alert_inst_def_id" btree (alert_definition_id), tablespace "tbls5" Check constraints: "ck_alert_inst_acked" CHECK (acknowledged =3D 0 OR acknowledged =3D 1) "ck_alert_inst_active" CHECK (active =3D 0 OR active =3D 1) "ck_alert_inst_set_cl_tm" CHECK (user_set_clear_time =3D 0 OR user_set_= clear_time =3D 1) "ck_alert_inst_viewer_vis" CHECK (viewer_visible =3D 0 OR viewer_visibl= e =3D 1) Foreign-key constraints: "fk_alert_inst_cat_id" FOREIGN KEY (category_id) REFERENCES ams.categor= y(category_id) "fk_alert_inst_def_id" FOREIGN KEY (alert_definition_id) REFERENCES ams= .alert_definition(alert_definition_id) "fk_alert_inst_unack_reason" FOREIGN KEY (unack_reason) REFERENCES ams.= unack_reason(unack_reason) Referenced by: TABLE "ams.alert_attribute" CONSTRAINT "fk_alert_attr_instance_id" FORE= IGN KEY (alert_instance_id) REFERENCES ams.alert_instance(alert_instance_id= ) ON DELETE CASCADE Triggers: _ams_cluster_logtrigger AFTER INSERT OR DELETE OR UPDATE ON ams.alert_i= nstance FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.logtrigger('_ams_cluste= r', '1', 'k') _ams_cluster_truncatetrigger BEFORE TRUNCATE ON ams.alert_instance FOR = EACH STATEMENT EXECUTE PROCEDURE _ams_cluster.log_truncate('1') Disabled user triggers: _ams_cluster_denyaccess BEFORE INSERT OR DELETE OR UPDATE ON ams.alert_= instance FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.denyaccess('_ams_clust= er') _ams_cluster_truncatedeny BEFORE TRUNCATE ON ams.alert_instance FOR EAC= H STATEMENT EXECUTE PROCEDURE _ams_cluster.deny_truncate() ams=3D#=20 --> PostgreSQL version number you are running: 9.5.14 --> How you installed PostgreSQL: We use a customized installer. It copies a =E2=80=9Cmake install=E2=80=9D-b= ased distribution into place on a target install host. Our compiler is gcc 5.4.0. CFLAGS: -m32 -march=3Dopteron -mno-3dnow -ggdb -O2 -Wall $P/CONFIGURE_OPTIONS :=3D \ --with-perl \ --with-openssl \ --with-libxml \ --with-libxslt \ --with-includes=3D"$(COMMON)/include/perl $(COMMON)/include" \ --with-libs=3D"$(COMMON)/lib" --prefix=3D$($P/PREFIX) \ --enable-debug \ --disable-nls --> Changes made to the settings in the postgresql.conf file: see Server C= onfiguration for a quick way to list them all. ams=3D# SELECT version(); version = =20 ---------------------------------------------------------------------------= --------------------------------------------- PostgreSQL 9.5.14 on i686-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubu= ntu1~16.04.9aka9.0.3) 5.4.0 20160609, 32-bit (1 row) ams=3D# SELECT name, current_setting(name), SOURCE ams-# FROM pg_settings ams-# WHERE SOURCE NOT IN ('default', 'override'); name | current_setting | source = =20 --------------------------------+--------------------+---------------------= - application_name | psql | client autovacuum_vacuum_cost_delay | 100ms | configuration file checkpoint_completion_target | 0.9 | configuration file client_encoding | SQL_ASCII | client cpu_index_tuple_cost | 0.001 | configuration file cpu_operator_cost | 0.0005 | configuration file cpu_tuple_cost | 0.002 | configuration file DateStyle | ISO, MDY | configuration file default_statistics_target | 150 | configuration file default_text_search_config | pg_catalog.english | configuration file effective_cache_size | 8007MB | configuration file lc_messages | C | configuration file lc_monetary | C | configuration file lc_numeric | C | configuration file lc_time | C | configuration file listen_addresses | 0.0.0.0 | configuration file log_autovacuum_min_duration | 0 | configuration file log_checkpoints | on | configuration file log_connections | on | configuration file log_disconnections | on | configuration file log_line_prefix | %m %p %u %h %d | configuration file log_min_duration_statement | 1min | configuration file log_min_messages | notice | configuration file log_temp_files | 0 | configuration file maintenance_work_mem | 512MB | configuration file max_connections | 600 | configuration file max_stack_depth | 2MB | environment variable max_wal_size | 15360TB | configuration file random_page_cost | 2.5 | configuration file restart_after_crash | off | configuration file shared_buffers | 2GB | configuration file ssl | on | configuration file ssl_ca_file | root.crt | configuration file standard_conforming_strings | on | configuration file statement_timeout | 1min | configuration file superuser_reserved_connections | 10 | configuration file syslog_ident | postgresql9.5-1.12 | configuration file tcp_keepalives_idle | 0 | configuration file unix_socket_permissions | 0770 | configuration file work_mem | 30MB | configuration file (40 rows) ams=3D#=20 --> Operating system and version: Ubuntu 16.04.5 LTS --> What program you're using to connect to PostgreSQL: Most DML is performed by a standalone JVM using the PostgreSQL JDBC Driver = v42.0.0. =20 --> Is there anything relevant or unusual in the PostgreSQL server logs?: We have sometimes but not always seen "invalid memory alloc request size" e= rrors around the time of these events. Our experience suggests that "invali= d memory alloc request size" errors are a symptom specifically of index cor= ruption and are remediated by reindexing. =20 --> For questions about any kind of error: --> What you were doing when the error happened / how to cause the error: Periodic DML (inserts and updates) focused primarily on two DB tables (ams.= alert_instance and ams.alert_attribute) with hourly batched transfers of in= active alerts to history tables (deletes from ams.alert_instance, ams.alert= _attribute and corresponding inserts to ams.alert_instance_hist, ams.alert_= attribute_hist within the same transaction). --> The EXACT TEXT of the error message you're getting, if there is one: (C= opy and paste the message to the email, do not send a screenshot) 2018-12-27 07:25:24.527 GMT 30462 appuser 127.0.0.1 ams ERROR: invalid byt= e sequence for encoding "UTF8": 0x86 The specific identified byte varies with each incident. --> CPU Info 2*4-core Intel(R) Xeon(R) CPU E31270 @ 3.40GHz --> Mem Info 16GB RAM --> Storage Info root@ams4.dfw.netmgmt:~# lsscsi -l [0:0:0:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sda=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:1:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdb=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:2:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdc=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:3:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdd=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:4:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sde=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:5:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdf=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:6:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdg=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 [0:0:7:0] disk ATA INTEL SSDSA2BW12 0362 /dev/sdh=20 state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked= =3D0 timeout=3D30 root@ams4.dfw.netmgmt:~#=20 root@ams4.dfw.netmgmt:~# modinfo md_mod filename: /lib/modules/4.14.68-4.14.3-amd64-3adf3675665129fa/kernel/d= rivers/md/md-mod.ko alias: block-major-9-* alias: md description: MD RAID framework license: GPL depends: =20 retpoline: Y intree: Y name: md_mod vermagic: 4.14.68-4.14.3-amd64-3adf3675665129fa SMP mod_unload modver= sions=20 parm: start_dirty_degraded:int parm: create_on_open:bool root@ams4.dfw.netmgmt:~#=20 Tom =C2=A0 =C2=A0:-) ------=_Part_10741937_1099546592.1553539577629 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Ho=
ping someone may be able to offer some guidance on this recurring problem. =
I am providing this "problem report" to the general list as I understand th=
e bugs list requires a set of reproduction steps we do not yet have. Please=
 advise if I have the process wrong. I have tried to provide all known rele=
vant info here. Thanks in advance for any insights.
--> A description of what you a=
re trying to achieve and what results you expect.:
We are experiencing intermitten=
t DB corruption in postgres 9.5.14. We are trying to identify and eliminate=
 all sources. We are using two independent services for data replication, S=
lony-I v2.2.6 and a custom service developed in-house. Both are based on CO=
PY operations. DB corruption is observed when COPY operations fail with an =
error of the form: 'invalid byte sequence for encoding "UTF8"'. This occurs=
 with a frequency ranging between a few days and several weeks. Each incide=
nt is followed by a race to find and repair or remove corrupted data, which=
 we are getting good at. With well over a dozen incidents, the great majori=
ty originally showed corruption in a single VARCHAR(2000) column (value) in=
 a single table (alert_attribute). In this time, we read about suspected an=
d real problems with TOAST functionality and so made the decision to change=
 alert_attribute.value to PLAIN storage. Since that change was made, most n=
ew incidents show corruption in the alert_attribute.name column instead (VA=
RCHAR(200)). Another table (alert_instance) has been impacted as well. See =
below for their schemas.

We have looked high and low through system logs and device reporting utilit=
y output for any sign of hardware failures. We haven't turned up anything y=
et. We also tried rebuilding an entire DB from scratch. That did not seem t=
o help.

We have not been performing routine reindexing. This is a problem we are wo=
rking to correct. Normally our master DB serves for an 8-12 week period wit=
hout reindexing before we failover to a peer. Before assuming the master ro=
le, the peer always begins by truncating the alert_instance and alert_attri=
bute tables and loading all data from the current master.

Hardware specs are listed below. For storage, we have 8 INTEL SSDSA2BW12 di=
rect-attached disks. We can provide additional info as needed.

ams=3D# \d ams.alert_attribute
               Table "ams.alert_attribute"
      Column       |          Type           | Modifiers=20
-------------------+-------------------------+-----------
 alert_instance_id | integer                 | not null
 name              | character varying(200)  | not null
 data_type         | smallint                | not null
 value             | character varying(2000) |=20
Indexes:
    "pk_alert_attributes" PRIMARY KEY, btree (alert_instance_id, name), tab=
lespace "tbls5"
    "idx_aa_aval" btree (name, value)
Foreign-key constraints:
    "fk_alert_attr_instance_id" FOREIGN KEY (alert_instance_id) REFERENCES =
ams.alert_instance(alert_instance_id) ON DELETE CASCADE
Triggers:
    _ams_cluster_logtrigger AFTER INSERT OR DELETE OR UPDATE ON ams.alert_a=
ttribute FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.logtrigger('_ams_clust=
er', '2', 'kk')
    _ams_cluster_truncatetrigger BEFORE TRUNCATE ON ams.alert_attribute FOR=
 EACH STATEMENT EXECUTE PROCEDURE _ams_cluster.log_truncate('2')
Disabled user triggers:
    _ams_cluster_denyaccess BEFORE INSERT OR DELETE OR UPDATE ON ams.alert_=
attribute FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.denyaccess('_ams_clus=
ter')
    _ams_cluster_truncatedeny BEFORE TRUNCATE ON ams.alert_attribute FOR EA=
CH STATEMENT EXECUTE PROCEDURE _ams_cluster.deny_truncate()

ams=3D#=20
ams=3D# \d ams.alert_instance=20
                    Table "ams.alert_instance"
       Column        |              Type              | Modifiers=20
---------------------+--------------------------------+-----------
 alert_instance_id   | integer                        | not null
 alert_definition_id | integer                        | not null
 alert_instance_key  | character varying(500)         | not null
 start_active_date   | timestamp(0) without time zone | not null
 stop_active_date    | timestamp(0) without time zone |=20
 active              | smallint                       | not null
 acknowledged        | smallint                       | not null
 ack_clear_time      | timestamp(0) without time zone |=20
 user_set_clear_time | smallint                       |=20
 category_id         | integer                        | not null
 condition_start     | timestamp(0) without time zone | not null
 unack_reason        | character varying(1)           |=20
 viewer_visible      | smallint                       | not null
Indexes:
    "pk_alert_instance" PRIMARY KEY, btree (alert_instance_id), tablespace =
"tbls5"
    "idx_alert_inst_1" btree (alert_instance_key, alert_definition_id, aler=
t_instance_id, active, acknowledged, ack_clear_time), tablespace "tbls5"
    "idx_alert_inst_cat_id" btree (category_id), tablespace "tbls5"
    "idx_alert_inst_def_id" btree (alert_definition_id), tablespace "tbls5"
Check constraints:
    "ck_alert_inst_acked" CHECK (acknowledged =3D 0 OR acknowledged =3D 1)
    "ck_alert_inst_active" CHECK (active =3D 0 OR active =3D 1)
    "ck_alert_inst_set_cl_tm" CHECK (user_set_clear_time =3D 0 OR user_set_=
clear_time =3D 1)
    "ck_alert_inst_viewer_vis" CHECK (viewer_visible =3D 0 OR viewer_visibl=
e =3D 1)
Foreign-key constraints:
    "fk_alert_inst_cat_id" FOREIGN KEY (category_id) REFERENCES ams.categor=
y(category_id)
    "fk_alert_inst_def_id" FOREIGN KEY (alert_definition_id) REFERENCES ams=
.alert_definition(alert_definition_id)
    "fk_alert_inst_unack_reason" FOREIGN KEY (unack_reason) REFERENCES ams.=
unack_reason(unack_reason)
Referenced by:
    TABLE "ams.alert_attribute" CONSTRAINT "fk_alert_attr_instance_id" FORE=
IGN KEY (alert_instance_id) REFERENCES ams.alert_instance(alert_instance_id=
) ON DELETE CASCADE
Triggers:
    _ams_cluster_logtrigger AFTER INSERT OR DELETE OR UPDATE ON ams.alert_i=
nstance FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.logtrigger('_ams_cluste=
r', '1', 'k')
    _ams_cluster_truncatetrigger BEFORE TRUNCATE ON ams.alert_instance FOR =
EACH STATEMENT EXECUTE PROCEDURE _ams_cluster.log_truncate('1')
Disabled user triggers:
    _ams_cluster_denyaccess BEFORE INSERT OR DELETE OR UPDATE ON ams.alert_=
instance FOR EACH ROW EXECUTE PROCEDURE _ams_cluster.denyaccess('_ams_clust=
er')
    _ams_cluster_truncatedeny BEFORE TRUNCATE ON ams.alert_instance FOR EAC=
H STATEMENT EXECUTE PROCEDURE _ams_cluster.deny_truncate()

ams=3D#=20

--> PostgreSQL version number you are running:
9.5.14

--> How you installed PostgreSQL:
We use a customized installer. It copies a =E2=80=9Cmake install=E2=80=9D-b=
ased distribution into place on a target install host.
Our compiler is gcc 5.4.0.

CFLAGS: -m32 -march=3Dopteron -mno-3dnow -ggdb -O2 -Wall

$P/CONFIGURE_OPTIONS :=3D \
        --with-perl \
        --with-openssl \
        --with-libxml \
        --with-libxslt \
        --with-includes=3D"$(COMMON)/include/perl $(COMMON)/include" \
        --with-libs=3D"$(COMMON)/lib" --prefix=3D$($P/PREFIX) \
        --enable-debug \
        --disable-nls

--> Changes made to the settings in the postgresql.conf file:  see Serve=
r Configuration for a quick way to list them all.
ams=3D# SELECT version();
                                                        version            =
                                            =20
---------------------------------------------------------------------------=
---------------------------------------------
 PostgreSQL 9.5.14 on i686-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubu=
ntu1~16.04.9aka9.0.3) 5.4.0 20160609, 32-bit
(1 row)

ams=3D# SELECT name, current_setting(name), SOURCE
ams-#   FROM pg_settings
ams-#   WHERE SOURCE NOT IN ('default', 'override');
              name              |  current_setting   |        source       =
=20
--------------------------------+--------------------+---------------------=
-
 application_name               | psql               | client
 autovacuum_vacuum_cost_delay   | 100ms              | configuration file
 checkpoint_completion_target   | 0.9                | configuration file
 client_encoding                | SQL_ASCII          | client
 cpu_index_tuple_cost           | 0.001              | configuration file
 cpu_operator_cost              | 0.0005             | configuration file
 cpu_tuple_cost                 | 0.002              | configuration file
 DateStyle                      | ISO, MDY           | configuration file
 default_statistics_target      | 150                | configuration file
 default_text_search_config     | pg_catalog.english | configuration file
 effective_cache_size           | 8007MB             | configuration file
 lc_messages                    | C                  | configuration file
 lc_monetary                    | C                  | configuration file
 lc_numeric                     | C                  | configuration file
 lc_time                        | C                  | configuration file
 listen_addresses               | 0.0.0.0            | configuration file
 log_autovacuum_min_duration    | 0                  | configuration file
 log_checkpoints                | on                 | configuration file
 log_connections                | on                 | configuration file
 log_disconnections             | on                 | configuration file
 log_line_prefix                | %m %p %u %h %d     | configuration file
 log_min_duration_statement     | 1min               | configuration file
 log_min_messages               | notice             | configuration file
 log_temp_files                 | 0                  | configuration file
 maintenance_work_mem           | 512MB              | configuration file
 max_connections                | 600                | configuration file
 max_stack_depth                | 2MB                | environment variable
 max_wal_size                   | 15360TB            | configuration file
 random_page_cost               | 2.5                | configuration file
 restart_after_crash            | off                | configuration file
 shared_buffers                 | 2GB                | configuration file
 ssl                            | on                 | configuration file
 ssl_ca_file                    | root.crt           | configuration file
 standard_conforming_strings    | on                 | configuration file
 statement_timeout              | 1min               | configuration file
 superuser_reserved_connections | 10                 | configuration file
 syslog_ident                   | postgresql9.5-1.12 | configuration file
 tcp_keepalives_idle            | 0                  | configuration file
 unix_socket_permissions        | 0770               | configuration file
 work_mem                       | 30MB               | configuration file
(40 rows)

ams=3D#=20

--> Operating system and version:
Ubuntu 16.04.5 LTS

--> What program you're using to connect to PostgreSQL:
Most DML is performed by a standalone JVM using the PostgreSQL JDBC Driver =
v42.0.0.
=20
--> Is there anything relevant or unusual in the PostgreSQL server logs?=
:
We have sometimes but not always seen "invalid memory alloc request size" e=
rrors around the time of these events. Our experience suggests that "invali=
d memory alloc request size" errors are a symptom specifically of index cor=
ruption and are remediated by reindexing.
=20
--> For questions about any kind of error:
--> What you were doing when the error happened / how to cause the error=
:
Periodic DML (inserts and updates) focused primarily on two DB tables (ams.=
alert_instance and ams.alert_attribute) with hourly batched transfers of in=
active alerts to history tables (deletes from ams.alert_instance, ams.alert=
_attribute and corresponding inserts to ams.alert_instance_hist, ams.alert_=
attribute_hist within the same transaction).

--> The EXACT TEXT of the error message you're getting, if there is one:=
 (Copy and paste the message to the email, do not send a screenshot)
2018-12-27 07:25:24.527 GMT 30462 appuser 127.0.0.1 ams ERROR:  invalid byt=
e sequence for encoding "UTF8": 0x86
The specific identified byte varies with each incident.

--> CPU Info
2*4-core Intel(R) Xeon(R) CPU E31270 @ 3.40GHz

--> Mem Info
16GB RAM

--> Storage Info
root@ams4.dfw.netmgmt:~# lsscsi -l

[0:0:0:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sda=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:1:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdb=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:2:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdc=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:3:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdd=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:4:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sde=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:5:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdf=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:6:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdg=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
[0:0:7:0]    disk    ATA      INTEL SSDSA2BW12 0362  /dev/sdh=20
  state=3Drunning queue_depth=3D32 scsi_level=3D7 type=3D0 device_blocked=
=3D0 timeout=3D30
root@ams4.dfw.netmgmt:~#=20

root@ams4.dfw.netmgmt:~# modinfo md_mod
filename:       /lib/modules/4.14.68-4.14.3-amd64-3adf3675665129fa/kernel/d=
rivers/md/md-mod.ko
alias:          block-major-9-*
alias:          md
description:    MD RAID framework
license:        GPL
depends:       =20
retpoline:      Y
intree:         Y
name:           md_mod
vermagic:       4.14.68-4.14.3-amd64-3adf3675665129fa SMP mod_unload modver=
sions=20
parm:           start_dirty_degraded:int
parm:           create_on_open:bool
root@ams4.dfw.netmgmt:~# 

Tom    :-)
------=_Part_10741937_1099546592.1553539577629--