Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mam/report wrong stanza id more friendly #3591

Merged
merged 2 commits into from
Mar 15, 2022
Merged

Conversation

NelsonVides
Copy link
Collaborator

If a client submits a stanza id that is not a valid one as generated by MIM's MAM, MAM is failing with a hard crash and returning the client a 500. This is not really friendly and doesn't help in debugging what went wrong.

In this PR I make it catch such an invalid id and return a more friendly 406-non_acceptable error, with a text description.

We can verify as well that the received IQ matches the one requested.
@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #3591 (2f6b47e) into master (02b6471) will decrease coverage by 0.04%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3591      +/-   ##
==========================================
- Coverage   80.92%   80.88%   -0.05%     
==========================================
  Files         426      426              
  Lines       32351    32364      +13     
==========================================
- Hits        26181    26178       -3     
- Misses       6170     6186      +16     
Impacted Files Coverage Δ
src/mam/mod_mam.erl 88.44% <85.71%> (-0.13%) ⬇️
src/mam/mod_mam_muc.erl 74.76% <85.71%> (+0.74%) ⬆️
src/mam/mod_mam_utils.erl 85.94% <100.00%> (+0.04%) ⬆️
src/event_pusher/mod_event_pusher_sns.erl 83.11% <0.00%> (-11.69%) ⬇️
src/rdbms/mongoose_rdbms.erl 62.54% <0.00%> (-1.82%) ⬇️
src/inbox/mod_inbox_rdbms_async.erl 65.51% <0.00%> (-1.73%) ⬇️
src/mod_blocking.erl 88.46% <0.00%> (-1.29%) ⬇️
src/domain/mongoose_domain_loader.erl 89.28% <0.00%> (-0.90%) ⬇️
src/privacy/mod_privacy.erl 85.00% <0.00%> (-0.84%) ⬇️
src/privacy/mod_privacy_rdbms.erl 77.94% <0.00%> (-0.52%) ⬇️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 02b6471...2f6b47e. Read the comment docs.

@mongoose-im
Copy link
Collaborator

mongoose-im commented Mar 15, 2022

small_tests_24 / small_tests / 2f6b47e
Reports root / small


small_tests_23 / small_tests / 2f6b47e
Reports root / small


dynamic_domains_pgsql_mnesia_23 / pgsql_mnesia / 2f6b47e
Reports root/ big
OK: 2821 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


dynamic_domains_mysql_redis_24 / mysql_redis / 2f6b47e
Reports root/ big
OK: 2804 / Failed: 0 / User-skipped: 150 / Auto-skipped: 0


dynamic_domains_pgsql_mnesia_24 / pgsql_mnesia / 2f6b47e
Reports root/ big
OK: 2821 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_23 / ldap_mnesia / 2f6b47e
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 399 / Auto-skipped: 0


dynamic_domains_mssql_mnesia_24 / odbc_mssql_mnesia / 2f6b47e
Reports root/ big
OK: 2821 / Failed: 0 / User-skipped: 133 / Auto-skipped: 0


ldap_mnesia_24 / ldap_mnesia / 2f6b47e
Reports root/ big
OK: 1504 / Failed: 0 / User-skipped: 399 / Auto-skipped: 0


internal_mnesia_24 / internal_mnesia / 2f6b47e
Reports root/ big
OK: 1545 / Failed: 0 / User-skipped: 358 / Auto-skipped: 0


elasticsearch_and_cassandra_24 / elasticsearch_and_cassandra_mnesia / 2f6b47e
Reports root/ big
OK: 1852 / Failed: 0 / User-skipped: 366 / Auto-skipped: 0


pgsql_mnesia_24 / pgsql_mnesia / 2f6b47e
Reports root/ big
OK: 3195 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


pgsql_mnesia_23 / pgsql_mnesia / 2f6b47e
Reports root/ big
OK: 3195 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


mysql_redis_24 / mysql_redis / 2f6b47e
Reports root/ big
OK: 3190 / Failed: 0 / User-skipped: 147 / Auto-skipped: 0


mssql_mnesia_24 / odbc_mssql_mnesia / 2f6b47e
Reports root/ big
OK: 3195 / Failed: 0 / User-skipped: 142 / Auto-skipped: 0


riak_mnesia_24 / riak_mnesia / 2f6b47e
Reports root/ big
OK: 1695 / Failed: 0 / User-skipped: 365 / Auto-skipped: 0

Copy link
Contributor

@arcusfelis arcusfelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@arcusfelis arcusfelis merged commit 6fe50c3 into master Mar 15, 2022
@arcusfelis arcusfelis deleted the mam/report_wrong_id branch March 15, 2022 13:53
@Premwoik Premwoik added this to the 5.1.0 milestone May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants