Comments (4)
Interesting, looks like MAM RSM query has troubles to be encoded: {rsm_in,50,aft,957926528636579656073,undefined}
.
That int is a bigint MAM message ID. But pgsql reported that it is an intereger of 0..255
range.
Please, write me the pgsql version (exact version, ideally from the docker hub). so, we can run our tests with it.
Also, do you use the default SQL schema?
Also, it could be that our code incorrectly detects the type of the count
when making a prepared query.
Could you also provide an XML stanza you send with this mam select query? because it looks like we do not log the stanza IQ when it causes a MAM backend errror.
when=2024-02-08T07:08:41.447449+00:00 level=error what=hook_failed reason="{{{{integer_overflow,int8,957926528636579656073},[{epgsql_codec_integer,overflow,2,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/datatypes/epgsql_codec_integer.erl\"},{line,44}]},{epgsql_codec_integer,encode,3,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/datatypes/epgsql_codec_integer.erl\"},{line,58}]},{epgsql_binary,encode_value,2,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/epgsql_binary.erl\"},{line,271}]},{epgsql_wire,encode_parameter,3,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/epgsql_wire.erl\"},{line,290}]},{epgsql_wire,encode_parameters,5,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/epgsql_wire.erl\"},{line,268}]},{epgsql_cmd_prepared_query,execute,2,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/commands/epgsql_cmd_prepared_query.erl\"},{line,38}]},{epgsql_sock,command_exec,4,[{file,\"/tmp/mongooseim/_build/default/lib/epgsql/src/epgsql_sock.erl\"},{line,383}]},{gen_server,try_handle_call,4,[{file,\"gen_server.erl\"},{line,1149}]}]},{gen_server,call,[<0.1838.0>,{command,epgsql_cmd_prepared_query,{{statement,[<<\"mam_message_count_u_leiequeqb_all\">>],[{column,<<\"count\">>,int8,20,8,-1,1,0,0}],[int8,int4,text],[{20,int8,false},{23,int4,false},{25,text,false}]},[{int8,957926528636579656073},{int4,922},{text,<<\"ab21-4238\">>}]}},infinity]}},{gen_server,call,['wpool_pool-mongoose_wpool$rdbms$global$default-1',{sql_cmd,{sql_execute,mam_message_count_u_leiequeqb_all,[957926528636579656073,922,<<\"ab21-4238\">>]},-576460040244},60000]}}" pid=<0.1988.0> at=gen_hook:error_running_hook/5:254 stacktrace="gen_server:call/3:385 mongoose_rdbms:execute_successfully/3:261 mam_lookup:calc_count/2:181 mam_lookup:lookup_messages_regular/4:132 mod_mam_rdbms_arch:lookup_messages/3:406 gen_hook:apply_hook_function/3:251 gen_hook:run_hook/4:237 mongoose_hooks:run_fold/4:1440" text="Error running hook" params_with_jid="{jid,<<\"ab21-4238\">>,<<\"msg.sashkas.com\">>,<<>>}" params_start_ts=undefined params_search_text=undefined params_rsm={rsm_in,50,aft,957926528636579656073,undefined} params_page_size=50 params_owner_jid="{jid,<<\"93f8-2852\">>,<<\"msg.sashkas.com\">>,<<>>}" params_ordering_direction=forward params_now=1707376121435724 params_max_result_limit=50 params_limit_passed=true params_is_simple=false params_end_ts=undefined params_caller_jid="{jid,<<\"93f8-2852\">>,<<\"msg.sashkas.com\">>,<<\"eh_iYT7T\">>}" params_borders=undefined params_archive_id=922 key="{mam_lookup_messages,<<\"msg.sashkas.com\">>}" handler="{hook_handler,50,fun mod_mam_rdbms_arch:lookup_messages/3,#{hook_name => mam_lookup_messages,hook_tag => <<\"msg.sashkas.com\">>,host_type => <<\"msg.sashkas.com\">>}}" when=2024-02-08T07:08:41.447425+00:00 level=error what=hook_failed reason="{{{{integer_overflow,int8,957926528636579656073},[{epgsql_codec_integer,overflow,2,[{file,\"/tmp/mongoo
from mongooseim.
Also, change your DB password, it is inside the log.
You should sanitize logs before posting them.
Log link is removed from your issue by me, but it is still uploaded to github.
from mongooseim.
SQL query, works fine for me:
{mam_message_count_u_leiequeqb_all,<<"mam_message">>,
[<<"id">>,<<"user_id">>,<<"remote_bare_jid">>],
<<"SELECT COUNT(*) FROM mam_message WHERE id <= ? AND user_id = ? AND remote_bare_jid = ? ">>},
Now waiting for your PgSQL version.
XML IQ:
<iq type='set' id='84fda6f59dea6a2d022721dad3e46cf0'>
<query xmlns='urn:xmpp:mam:1'>
<x xmlns='jabber:x:data' type='submit'>
<field var='with'>
<value>kate_querying_for_all_messages_with_jid_after_17@localhost</value>
</field>
</x>
<set>
<max>50</max>
<after>C487F52688G1</after>
</set>
</query>
</iq>
Ah, wait:
mod_mam_utils:mess_id_to_external_binary(957926528636579656073).
<<"PURPLEFE965CC9">>
ok, I see. You trying to provide something too big to be represented as a bigint of size 8 bytes, after decoding from base32.
Check your code, you are probably supplying invalid mam ids as an input... We could add the format validation to MongooseIM though here.
from mongooseim.
It just returns an empty result set and crashes on the server.
Apparently, that PR should've been wider to also cover SQL query failing: https://github.com/esl/MongooseIM/pull/4191/files
Two tasks for MIM would be added into a backlog:
- fail with a reasonable error message, when ID is invalid (when it cannot be decoded into bigint).
- fail with a reasonable error IQ, when an SQL query fails, instead of just returning an empty result set. We have logging though, it is how you found the bug. For the front-end client there is no way to check that it failed though.
Also:
- fail with reasonable text message instead of just 404, when a message not found with specific ID in
<after/>
.
from mongooseim.
Related Issues (20)
- 4.5.0-alpha1 smack: Message Archive Management is not supported by HOT 3
- `mod_blocking` doesn't stop messages from being processed by `modules.mod_mam.pm` or `mod_inbox` HOT 2
- How to get actual message xml packet with external code or by direct database query in MAM HOT 9
- mongooseimctl ipv6 support HOT 9
- Duplicated messages in `mam_message` HOT 4
- -proto_dist inet6_tcp support? HOT 2
- mod_pubsub using subscribee returns bad-request, invalid-jid HOT 2
- Message sending failure with OMEMO HOT 2
- Change config in muclight replacing old config
- GraphQL session ListSessions returns empty lists
- `max_stanza_size` doesn't work with websockets HOT 2
- How to use wss ? HOT 4
- GraphQL SSE crashes on large message stanza payload HOT 1
- How does mongooseim handle unacknowledged stanza's ? HOT 2
- Mongooseim not sending push notifications to disconnected clients HOT 4
- mod_event_pusher HTTP only sends chat type messages HOT 2
- How to implement stream resumption in XEP-0198 stream management from client side ? HOT 7
- Messages send through push notifications again resended to the client upon reconnection HOT 2
- how to send push notification data to my custom http endpoint instead of mongoosepush? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongooseim.