[pgpool-general: 3927] Re: pgpool2 "invalid byte sequence for encoding "UTF8": 0xe5 0x02"

Yura Ivanovskiy freemanlutsk at gmail.com
Thu Aug 6 12:20:52 JST 2015


This is not easy, because this random  not all inserts with problem.
For example If i tried insert manualy (with psql or ruby console) - all
works fine:

Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:
 pool_send_and_wait: Error or notice message from backend: : DB node id: 0
backend pid: 14884 statement: "INSERT INTO "clic" ("android_id", "app_id",
"campaign_image_id", "campaign_url_id", "country_id", "created_at",
"device_id", "ip", "type", "ua", "updated_at", "user_only", "white_sdk",
"x_forwarded") VALUES ('ee543782-ace7-41fb-85e7-21022d132244', 5468, 937,
568, 42, '2015-08-05 09:18:20.501305', 673012, '85.99.1.1', 2,
'Dalvik/1.6.0 (Linux; U; Android 4.1.2; GT-I9105P Build/JZO54K)',
'2015-08-05 09:18:20.501305', 'f', 't', '85.99.1.1') RETURNING "id""
message: "invalid byte sequence for encoding "UTF8": 0xe5 0x02"

INSERT INTO "clic" ("android_id", "app_id", "campaign_image_id",
"campaign_url_id", "country_id", "created_at", "device_id", "ip", "type",
"ua", "updated_at", "user_only", "white_sdk", "x_forwarded") VALUES
('ee543782-ace7-41fb-85e7-21022d132244', 5468, 937, 568, 42, '2015-08-05
09:18:20.501305', 673012, '85.99.1.1', 2, 'Dalvik/1.6.0 (Linux; U; Android
4.1.2; GT-I9105P Build/JZO54K)', '2015-08-05 09:18:20.501305', 'f', 't',
'85.99.1.1') RETURNING "id";
    id
----------
 59095624
(1 row)

Why "pgpool"  giving error?

2015-08-06 6:00 GMT+03:00 Tatsuo Ishii <ishii at postgresql.org>:

> I need the INSERT statement your application sent to pgpool-II so that
> I could reproduce the problem. Please attach the statement (not
> include in the mail).
>
> Best regards,
> --
> Tatsuo Ishii
> SRA OSS, Inc. Japan
> English: http://www.sraoss.co.jp/index_en.php
> Japanese:http://www.sraoss.co.jp
>
> > How I can resolve this issue?
> >
> > 2015-08-05 13:17 GMT+03:00 Yura Ivanovskiy <freemanlutsk at gmail.com>:
> >
> >> Yes, in the application
> >>  encoding: unicode
> >>
> >> 2015-08-05 12:46 GMT+03:00 Tatsuo Ishii <ishii at postgresql.org>:
> >>
> >>> > thanx for answers
> >>> > please look at this part of log
> >>> > that is, data mangled and don't sending to backend, right?
> >>>
> >>> No. The message "invalid byte sequence for encoding "UTF8": 0xe5 0x02"
> >>> comes from backend and pgpool-II just shows it. You did't mention if
> >>> 1) is your case or not. So I ask you again: Do you set client encoding
> >>> to other than UTF-8?
> >>>
> >>> Best regards,
> >>> --
> >>> Tatsuo Ishii
> >>> SRA OSS, Inc. Japan
> >>> English: http://www.sraoss.co.jp/index_en.php
> >>> Japanese:http://www.sraoss.co.jp
> >>>
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14483: LOG:
> fetch
> >>> > from memory cache
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14483: DETAIL:
> >>> query
> >>> > result fetched from cache. statement: SELECT 1
> >>> >
> >>> >
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:  DB
> >>> node
> >>> > id: 0 backend pid: 14884 statement: Parse: INSERT INTO "clic"
> >>> > ("android_id", "app_id", "campaign_image_id", "campaign_url_id",
> >>> > "country_id", "created_at", "device_id", "ip", "type", "ua",
> >>> "updated_at",
> >>> > "user_only", "white_sdk", "x_forwarded") VALUES
> >>> > ('ee543782-ace7-41fb-85e7-21022d132244', 5468, 937, 568, 42,
> '2015-08-05
> >>> > 09:18:20.501305', 673012, '85.99.1.1', 2, 'Dalvik/1.6.0 (Linux; U;
> >>> Android
> >>> > 4.1.2; GT-I9105P Build/JZO54K)', '2015-08-05 09:18:20.501305', 'f',
> 't',
> >>> > '85.99.1.1') RETURNING "id"
> >>> >
> >>> >
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:
> >>> >  pool_send_and_wait: Error or notice message from backend: : DB node
> >>> id: 0
> >>> > backend pid: 14884 statement: "INSERT INTO "clic" ("android_id",
> >>> "app_id",
> >>> > "campaign_image_id", "campaign_url_id", "country_id", "created_at",
> >>> > "device_id", "ip", "type", "ua", "updated_at", "user_only",
> "white_sdk",
> >>> > "x_forwarded") VALUES ('ee543782-ace7-41fb-85e7-21022d132244', 5468,
> >>> 937,
> >>> > 568, 42, '2015-08-05 09:18:20.501305', 673012, '85.99.1.1', 2,
> >>> > 'Dalvik/1.6.0 (Linux; U; Android 4.1.2; GT-I9105P Build/JZO54K)',
> >>> > '2015-08-05 09:18:20.501305', 'f', 't', '85.99.1.1') RETURNING "id""
> >>> > message: "invalid byte sequence for encoding "UTF8": 0xe5 0x02"
> >>> >
> >>> >
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:
> Parse:
> >>> > Error or notice message from backend: : DB node id: 0 backend pid:
> 14884
> >>> > statement: "INSERT INTO "clic" ("android_id", "app_id",
> >>> > "campaign_image_id", "campaign_url_id", "country_id", "crHå#002"
> >>> message:
> >>> > "invalid byte sequence for encoding "UTF8": 0xe5 0x02"
> >>> >
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:
> >>> >  statement: ROLLBACK
> >>> > Aug  5 09:18:20 pg1 pgpool: 2015-08-05 09:18:20: pid 14744: LOG:  DB
> >>> node
> >>> > id: 0 backend pid: 14884 statement: ROLLBACK
> >>> >
> >>> >
> >>> > in /var/log/postgresql/postgresql-9.3-main.log only
> >>> >
> >>> > 2015-08-05 09:18:20 UTC ERROR:  invalid byte sequence for encoding
> >>> "UTF8":
> >>> > 0xe5 0x02
> >>> > ...
> >>> >
> >>> > 2015-08-05 11:50 GMT+03:00 Tatsuo Ishii <ishii at postgresql.org>:
> >>> >
> >>> >> I meant the "od" command.
> >>> >>
> >>> >> Best regards,
> >>> >> --
> >>> >> Tatsuo Ishii
> >>> >> SRA OSS, Inc. Japan
> >>> >> English: http://www.sraoss.co.jp/index_en.php
> >>> >> Japanese:http://www.sraoss.co.jp
> >>> >>
> >>> >> >> You may want to use od to grab exact data.
> >>> >> >
> >>> >> > I don't fully understood it. "od"- ?
> >>> >> >
> >>> >> > 2015-08-05 10:28 GMT+03:00 Tatsuo Ishii <ishii at postgresql.org>:
> >>> >> >
> >>> >> >> There are two possibilites.
> >>> >> >>
> >>> >> >> 1) you are using "client_encoding": ie. your frontend uses
> >>> ISO-8859-1
> >>> >> >>    or something like that and PostgreSQL uses UTF-8.
> Unfortunately
> >>> >> >>    pgpool-II does not support client_encoding.
> >>> >> >>
> >>> >> >> 2) The data you sent is mungled somewhere between pgpool and
> >>> >> >>    PostgreSQL. You can check that by comparing 'Dalvik/1.6.0...'
> >>> (the
> >>> >> >>    original data in your INSERT statement), that one in the pgool
> >>> log
> >>> >> >>    and that one in the PostgreSQL log. You may want to use od to
> >>> grab
> >>> >> >>    exact data.
> >>> >> >>
> >>> >> >> Best regards,
> >>> >> >> --
> >>> >> >> Tatsuo Ishii
> >>> >> >> SRA OSS, Inc. Japan
> >>> >> >> English: http://www.sraoss.co.jp/index_en.php
> >>> >> >> Japanese:http://www.sraoss.co.jp
> >>> >> >>
> >>> >> >> > Hi all!
> >>> >> >> > I have trouble with pgpool.
> >>> >> >> > For now I use it in testing mode, at first sight all works
> fine.
> >>> But
> >>> >> some
> >>> >> >> > query ("inserts"), finishing with error
> >>> >> >> >
> >>> >> >> > Aug  4 18:18:43 pg1 pgpool: 2015-08-04 18:18:43: pid 18878:
> LOG:
> >>> >> Parse:
> >>> >> >> > Error or notice message from backend: : DB node id: 0 backend
> pid:
> >>> >> 18915
> >>> >> >> > statement:
> >>> >> >> > "INSERT INTO "clic" ("a_id", "app_id", "c_image_id",
> "c_url_id",
> >>> >> >> > "count_id", "created_at", "dev_id", "ip", "type", "ua",
> >>> "updated_at",
> >>> >> >> > "ur_only", "w_sk", "x_fd") VALUES
> >>> >> >> ('a1a99f3e-f0b5-44b1-98bb-2c10a9bd2112',
> >>> >> >> > 4313, 403, 174, 24, '2015-08-04 18:18:43.766423', 711675,
> >>> >> '119.161.65.6',
> >>> >> >> > 1, 'Dalvik/1.6.0 H�#002" message: "invalid byte sequence for
> >>> encoding
> >>> >> >> > "UTF8": 0xe5 0x02"
> >>> >> >> >
> >>> >> >> > What I doing wrong?
> >>> >> >> >
> >>> >> >> > If I connect application without pgpool - all works without any
> >>> >> errors.
> >>> >> >> >
> >>> >> >> > Thanx in advance for any help!
> >>> >> >> >
> >>> >> >> > pgpool-II version 3.4.2 (tataraboshi)
> >>> >> >> >
> >>> >> >> > listen_addresses = '*'
> >>> >> >> > port = 5434
> >>> >> >> > socket_dir = '/var/run/postgresql'
> >>> >> >> > listen_backlog_multiplier = 2
> >>> >> >> > pcp_listen_addresses = '*'
> >>> >> >> > pcp_port = 9898
> >>> >> >> > pcp_socket_dir = '/var/run/postgresql'
> >>> >> >> > backend_hostname0 = '10.0.0.1'
> >>> >> >> > backend_port0 = 5432
> >>> >> >> > backend_weight0 = 1
> >>> >> >> > backend_data_directory0 = '/var/lib/postgresql/9.3/main/'
> >>> >> >> > backend_flag0 = 'ALLOW_TO_FAILOVER'
> >>> >> >> > enable_pool_hba = off
> >>> >> >> > pool_passwd = 'pool_passwd'
> >>> >> >> > authentication_timeout = 60
> >>> >> >> > ssl = on
> >>> >> >> > ssl_key = '/etc/ssl/private/ssl-cert-snakeoil.key'
> >>> >> >> > ssl_cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
> >>> >> >> > num_init_children = 48
> >>> >> >> > max_pool = 5
> >>> >> >> > child_life_time = 300
> >>> >> >> > child_max_connections = 0
> >>> >> >> > connection_life_time = 0
> >>> >> >> > client_idle_limit = 0
> >>> >> >> > log_destination = 'stderr'
> >>> >> >> > log_connections = off
> >>> >> >> > log_hostname = off
> >>> >> >> > log_statement = off
> >>> >> >> > log_per_node_statement = off
> >>> >> >> > log_standby_delay = 'none'
> >>> >> >> > syslog_facility = 'LOCAL0'
> >>> >> >> > syslog_ident = 'pgpool'
> >>> >> >> > debug_level = 1
> >>> >> >> > pid_file_name = '/var/run/postgresql/pgpool.pid'
> >>> >> >> > logdir = '/var/log/postgresql'
> >>> >> >> > connection_cache = on
> >>> >> >> > reset_query_list = 'ABORT; DISCARD ALL'
> >>> >> >> > replication_mode = off
> >>> >> >> > replicate_select = off
> >>> >> >> > insert_lock = on
> >>> >> >> > lobj_lock_table = ''
> >>> >> >> > replication_stop_on_mismatch = off
> >>> >> >> > failover_if_affected_tuples_mismatch = off
> >>> >> >> > load_balance_mode = on
> >>> >> >> > ignore_leading_white_space = on
> >>> >> >> > white_function_list = ''
> >>> >> >> > black_function_list = 'nextval,setval,nextval,setval'
> >>> >> >> > database_redirect_preference_list = ''
> >>> >> >> > app_name_redirect_preference_list = ''
> >>> >> >> > allow_sql_comments = off
> >>> >> >> > master_slave_mode = on
> >>> >> >> > master_slave_sub_mode = 'stream'
> >>> >> >> > sr_check_period = 0
> >>> >> >> > sr_check_user = 'postgres'
> >>> >> >> > sr_check_password = ''
> >>> >> >> > delay_threshold = 0
> >>> >> >> > follow_master_command = ''
> >>> >> >> > health_check_period = 0
> >>> >> >> > health_check_timeout = 20
> >>> >> >> > health_check_user = 'postgres'
> >>> >> >> > health_check_password = ''
> >>> >> >> > health_check_max_retries = 0
> >>> >> >> > health_check_retry_delay = 1
> >>> >> >> > connect_timeout = 10000
> >>> >> >> > failover_command = ''
> >>> >> >> > failback_command = ''
> >>> >> >> > fail_over_on_backend_error = on
> >>> >> >> > search_primary_node_timeout = 10
> >>> >> >> > recovery_user = 'postgres'
> >>> >> >> > recovery_password = ''
> >>> >> >> > recovery_1st_stage_command = ''
> >>> >> >> > recovery_2nd_stage_command = ''
> >>> >> >> > recovery_timeout = 90
> >>> >> >> > client_idle_limit_in_recovery = 0
> >>> >> >> > use_watchdog = off
> >>> >> >> > trusted_servers = ''
> >>> >> >> > ping_path = '/bin'
> >>> >> >> > wd_hostname = ''
> >>> >> >> > wd_port = 9000
> >>> >> >> > wd_authkey = ''
> >>> >> >> > delegate_IP = ''
> >>> >> >> > ifconfig_path = '/sbin'
> >>> >> >> > if_up_cmd = 'ifconfig eth0:0 inet $_IP_$ netmask 255.255.255.0'
> >>> >> >> > if_down_cmd = 'ifconfig eth0:0 down'
> >>> >> >> > arping_cmd = 'arping -U $_IP_$ -w 1'
> >>> >> >> > clear_memqcache_on_escalation = on
> >>> >> >> > wd_escalation_command = ''
> >>> >> >> > wd_lifecheck_method = 'heartbeat'
> >>> >> >> > wd_interval = 10
> >>> >> >> > wd_heartbeat_port = 9694
> >>> >> >> > wd_heartbeat_keepalive = 2
> >>> >> >> > wd_heartbeat_deadtime = 30
> >>> >> >> > heartbeat_destination0 = 'host0_ip1'
> >>> >> >> > heartbeat_destination_port0 = 9694
> >>> >> >> > heartbeat_device0 = ''
> >>> >> >> > wd_life_point = 3
> >>> >> >> > wd_lifecheck_query = 'SELECT 1'
> >>> >> >> > wd_lifecheck_dbname = 'template1'
> >>> >> >> > wd_lifecheck_user = 'postgres'
> >>> >> >> > wd_lifecheck_password = ''
> >>> >> >> > relcache_expire = 0
> >>> >> >> > relcache_size = 256
> >>> >> >> > check_temp_table = on
> >>> >> >> > check_unlogged_table = on
> >>> >> >> > memory_cache_enabled = on
> >>> >> >> > memqcache_method = 'shmem'
> >>> >> >> > memqcache_memcached_host = 'localhost'
> >>> >> >> > memqcache_memcached_port = 11211
> >>> >> >> > memqcache_total_size = 67108864
> >>> >> >> > memqcache_max_num_cache = 1000000
> >>> >> >> > memqcache_expire = 0
> >>> >> >> > memqcache_auto_cache_invalidation = on
> >>> >> >> > memqcache_maxcache = 409600
> >>> >> >> > memqcache_cache_block_size = 10485760
> >>> >> >> > memqcache_oiddir = '/var/log/pgpool/oiddir'
> >>> >> >> > white_memqcache_table_list = ''
> >>> >> >> > black_memqcache_table_list = ''
> >>> >> >>
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > --
> >>> >>
> >>> >
> >>> >
> >>> >
> >>> > --
> >>>
> >>
> >>
> >>
> >> --
> >>
> >>
> >
> >
> > --
>



--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-general/attachments/20150806/057e5663/attachment-0001.html>


More information about the pgpool-general mailing list