1

Topic: amavis / invalid input syntax for type bytea at (eval 108) line 173

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):  1.4.0 PGSQL edition
- Deployed with iRedMail Easy or the downloadable installer? iRedmail Easy
- Linux/BSD distribution name and version: Ubuntu focal 20.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

After update to 1.4.0 from 1.3.2 with upgrade manual, i regularly get some warnings about amavis.

/var/log/mail.log:

Aug  9 17:12:37 mx amavis[1249483]: (1249483-19) (!)WARN save_info_final: sql exec: err=7, 22P02, DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bytea at (eval 108) line 173.
Aug  9 17:12:40 mx amavis[1249483]: (1249483-19) (!)WARN save_info_final: sql exec: err=7, 22P02, DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bytea at (eval 108) line 173.
Aug  9 17:12:41 mx amavis[1249483]: (1249483-19) (!)WARN save_info_final: sql exec: err=7, 22P02, DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bytea at (eval 108) line 173.
Aug  9 17:12:42 mx amavis[1249483]: (1249483-19) (!)WARN save_info_final: sql exec: err=7, 22P02, DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bytea at (eval 108) line 173.
Aug  9 17:12:43 mx amavis[1249483]: (1249483-19) (!)WARN save_info_final: sql exec: err=7, 22P02, DBD::Pg::st execute failed: ERROR:  invalid input syntax for type bytea at (eval 108) line 173.
Aug  9 17:12:43 mx amavis[1249483]: (1249483-19) (!!)ERROR sql_storage: too many retries on storing final, info not saved

/var/log/postgresql/postgresql-12-main.log:

2021-08-09 17:12:21.404 MSK [1256599] vmailadmin@vmail LOG:  could not receive data from client: Connection reset by peer
2021-08-09 17:12:21.404 MSK [1256594] vmail@vmail LOG:  could not receive data from client: Connection reset by peer
2021-08-09 17:12:37.328 MSK [1249514] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:37.328 MSK [1249514] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:37.401 MSK [1249800] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:37.401 MSK [1249800] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:37.404 MSK [1249730] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:37.404 MSK [1249730] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:38.415 MSK [1256859] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:38.415 MSK [1256859] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:40.343 MSK [1256864] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:40.343 MSK [1256864] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:40.417 MSK [1256865] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:40.417 MSK [1256865] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:41.428 MSK [1256866] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:41.428 MSK [1256866] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:41.428 MSK [1256867] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:41.428 MSK [1256867] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:42.355 MSK [1256868] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:42.355 MSK [1256868] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:42.440 MSK [1256869] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:42.440 MSK [1256869] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:43.452 MSK [1256871] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:43.452 MSK [1256871] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:44.440 MSK [1256872] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:44.440 MSK [1256872] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:45.368 MSK [1256873] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:45.368 MSK [1256873] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:46.453 MSK [1256874] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:46.453 MSK [1256874] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:12:48.380 MSK [1256876] amavisd@amavisd ERROR:  invalid input syntax for type bytea
2021-08-09 17:12:48.380 MSK [1256876] amavisd@amavisd STATEMENT:  UPDATE msgs SET content=$1, quar_type=$2, quar_loc=$3, dsn_sent=$4, spam_level=$5, message_id=$6, from_addr=$7, subject=$8, client_addr=$9, originating=$10 WHERE partition_tag=$11 AND mail_id=$12
2021-08-09 17:13:40.352 MSK [1256863] vmailadmin@vmail LOG:  could not receive data from client: Connection reset by peer
2021-08-09 17:13:40.352 MSK [1256862] vmailadmin@vmail LOG:  could not receive data from client: Connection reset by peer
2021-08-09 17:13:40.352 MSK [1256858] vmail@vmail LOG:  could not receive data from client: Connection reset by peer
2021-08-09 17:13:40.352 MSK [1256857] vmail@vmail LOG:  could not receive data from client: Connection reset by peer

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: amavis / invalid input syntax for type bytea at (eval 108) line 173

Looks like some column type is incorrect. Please compare the SQL structures of "amavisd" database tables with the default one:
https://github.com/iredmail/iRedMail/bl … visd.pgsql

3 (edited by koto 2021-10-14 08:59:22)

Re: amavis / invalid input syntax for type bytea at (eval 108) line 173

Most likely https://forum.iredmail.org/topic15585-e … -inst.html and still not fixed in 1.4.2

>This is postgres10. Happens on xenial with postgres9.5 too, also with postgres11.
> It's easy to reproduce this, just send an email that has backslash in the subject, followed by something (like \w, or \dt, or...).

Solution:

psql
\c amavisd;
ALTER TABLE msgs ALTER COLUMN subject TYPE text;