[ejabberd] "bad argument in call to erlang:iolist_to_binary" since 19.09.1

Badlop badlop at gmail.com
Fri Dec 13 19:40:56 MSK 2019


Hi

The first three errors mention a problem converting a long string into binary:
 erlang:iolist_to_binary([73,116,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,116,111,32,115,101,110,100,32,...]).
Those characters provided translate into: "It is not allowed to send "
There are a few strings that start like that in mod_muc_room.erl, and
they are used to build a string appending the occupant nickname in
Binary format and the error condition in String format.

Case 1: Such a conversion works correctly for me using Erlang/OTP
21.2, just as an example:
$ erl
erlang:iolist_to_binary([73,116,32,105,115,32,110,111,32, "undefined",
32, <<"user1">> ]).
<<"It is no undefined user1">>

However, maybe you are using an older (less capable) or a newer (more
strict) Erlang version that doesn't accept arguments like this. Can
you start erl, try that example and report if it succeeds or fails?

Case 2: If that succeeds for you too, then the problem is in one of
those calls in mod_muc_room.erl, that maybe allows something weird to
get into the argument. For example:
$ erl
1> erlang:iolist_to_binary([73,116,32,105,115,32,110,111,32,
"undefined", 32, undefined ]).
** exception error: bad argument
    in function  iolist_to_binary/1
       called as
iolist_to_binary([73,116,32,105,115,32,110,111,32,"undefined",32,undefined])

To investigate that second case, it would help to view the string with
the problematic elements, like in that example. For that, you can edit
mod_muc_room.erl source code, and remove some words of the three
strings that start with "It is not allowed to send ", so that the
arguments get shown in the error messages.

---
Badlop
ProcessOne

On Mon, 9 Dec 2019 at 22:24, Maximilian Trummer <maximilian at trummer.xyz> wrote:
>
> Since upgrading from ejabberd 19.08 to 19.09.1, I see the following errors repeatedly:
>
> 2019-12-07 14:25:05.927 [error] <0.507.0>@str:format:289 gen_fsm <0.507.0> in state normal_state terminated with reason: bad argument in call to erlang:iolist_to_binary([73,116,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,116,111,32,115,101,110,100,32,...]) in str:format/2 line 289
> 2019-12-07 14:25:05.927 [error] <0.507.0>@str:format:289 CRASH REPORT Process <0.507.0> with 0 neighbours exited with reason: bad argument in call to erlang:iolist_to_binary([73,116,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,116,111,32,115,101,110,100,32,...]) in str:format/2 line 289
> 2019-12-07 14:25:05.927 [error] <0.466.0>@str:format:289 Supervisor 'mod_muc_room_sup_mydomain.com' had child undefined started with {mod_muc_room,start_link,undefined} at <0.507.0> exit with reason bad argument in call to erlang:iolist_to_binary([73,116,32,105,115,32,110,111,116,32,97,108,108,111,119,101,100,32,116,111,32,115,101,110,100,32,...]) in str:format/2 line 289 in context child_terminated
> 2019-12-07 14:50:22.595 [error] <0.474.0>@ejabberd_sql:check_error:1195 SQL query 'Q37448423' at {mod_mam_sql,122} failed: [{severity,'FEHLER'},{86,<<"ERROR">>},{code,<<"22021">>},{message,<<"ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00">>},{file,<<"wchar.c">>},{line,2017},{routine,<<"report_invalid_encoding">>}]
> 2019-12-07 14:56:23.372 [error] <0.474.0>@ejabberd_sql:check_error:1195 SQL query 'Q37448423' at {mod_mam_sql,122} failed: [{severity,'FEHLER'},{86,<<"ERROR">>},{code,<<"22021">>},{message,<<"ungültige Byte-Sequenz für Kodierung »UTF8«: 0x00">>},{file,<<"wchar.c">>},{line,2017},{routine,<<"report_invalid_encoding">>}]
>
> First there's an error in gen_fsm and then SQL errors about a nullbyte.
> This repeats every few hours with the argument in iolist_to_binary
> (73,116,32,105,115,32,110...) and the SQL query (Q37448423) always the same.
> The database is PostgreSQL 10.
> Unfortunately I don't know how to reproduce the errors.
> Any ideas what it could be?
>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd


More information about the ejabberd mailing list