-
Notifications
You must be signed in to change notification settings - Fork 228
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
High database usage by get_auth_chain_ids_chains
after no particular event
#17470
Comments
I enabled
Could this be a symptom of GHSA-3h7q-rfh9-xm4v ? EDIT: it does not seem so, I just updated to v1.111 and the issue persists. |
As it seems the problem came from intensive recursive SQL queries, I tried to issue a The |
As my best clue was the logs shown in #17470 (comment), I decided to find what rooms were affected. So I used the following query where SELECT room_id
FROM event_auth_chains AS chains
INNER JOIN events ON (chains.event_id = events.event_id)
WHERE chain_id = 444066; In my case, I had multiple long queries all linking to EDIT: hmm... not really, there are a lot of other rooms that show this behaviour |
same behavior on my side. Running |
I still have this issue, here is the query / plan https://explain.dalibo.com/plan/271d35b19fe84g32#plan
explain WITH RECURSIVE links(chain_id) AS ( SELECT DISTINCT origin_chain_id FROM event_auth_chain_links WHERE origin_chain_id = ANY(ARRAY[252142,252143,317683,252144,252145,252146,252147,252148,252149,252150,252151,252152,252153,252154,252155,252156,252157,317698,252158,252159,252160,252161,252162,317704,252163,252164,252165,317708,252166,317710,252167,317712,252168,252169,252170,252171,317717,252173,252174,252175,252176,252177,252178,252179,317725,317726,317727,252183,252184,252185,252186,252187,252188,252189,252190,252191,252192,252193,317739,252195,252196,252197,252198,252199,252200,252201,252202,252203,252204,317750,317751,252207,252208,317754,252210,252211,252212,252213,252214,252215,252216,252217,252218,252219,252220,252221,252222,252223,317769,317770,317777,317792,317797,317801,317804,317809,317821,317827,317833,317843,317849,317854,252324,252325,252326,252327,252328,252329,252330,252331,252332,252333,252334,252335,252336,252337,252338,252339,252340,252341,317878,317879,252342,252343,317882,317883,252344,317885,252345,252346,317888,252347,252348,317891,252349,317893,252350,252351,252352,252353,317898,252354,252355,252356,252357,252358,252359,317905,252361,252362,252363,252364,252365,317911,252367,252368,252369,252370,252371,252372,252373,252374,317920,252376,252377,252378,252379,252380,317926,252382,317928,317929,252385,252386,252387,252388,252389,252390,252391,252392,252393,252394,252395,252396,317942,252398,252399,252400,252401,252402,252403,252404,252405,317951,252407,252408,252409,252410,252411,252412,252413,252414,252415,252416,252417,317963,252419,252420,252421,252422,252423,317972,317977,317978,317981,317986,317991,317992,317993,318000,318004,318007,318015,318026,318039,318045,318052,318053,318071,318092,318109,318114,318125,318139,318142,318143,318145,318146,252611,252612,252613,252614,252615,252616,252617,252618,252619,252620,252621,252622,252623,252624,252625,252626,318163,252627,252628,252629,252630,252631,252632,252633,252634,252635,252636,252637,252638,252639,318177,252640,252641,252642,318181,252643,252644,252645,252646,252647,252648,252649,252650,318190,252651,252652,318193,252653,252654,252655,252656,252657,252658,252659,252660,252661,252662,252663,252664,252665,252666,252667,252668,252669,252670,252671,252672,252673,252674,252675,252676,252677,252678,252679,252680,252681,252682,252683,252684,252685,252686,252687,252688,252689,252690,252691,252692,252693,252694,252695,252696,252697,252698,252699,252700,252701,252702,252703,252704,252705,252706,252707,252708,252709,252710,318262,318269,318272,318278,318280,318287,318300,318311,318319,318328,318335,318336,318337,318346,252811,252812,252813,252814,252815,318352,252816,252817,252818,252819,252820,252821,252822,318360,252823,252824,252825,252826,252827,252828,252829,252830,318369,252831,252832,252833,252834,252835,252836,252837,252838,252839,252840,252841,318381,252842,252843,318384,252844,318386,252845,318388,252846,252847,318391,252848,252849,318394,252850,252851,252852,252853,252854,252855,252856,252857,252858,318404,252860,318406,252862,318408,318409,252865,252866,318412,252868,252869,252870,252871,252872,252873,252874,252875,252876,252877,252878,252879,318425,252881,252882,318428,252884,252885,252886,252887,252888,318434,252890,252891,252892,252893,252894,252895,252896,252897,252898,252899,252900,252901,252902,252903,318449,252905,252906,252907,252908,318454,252910,318456,318459,318463,318467,318487,318493,318494,318496,318498,318509,318514,318515,318539,318541,318552,318553,318559,318578,318580,318588,318593,318594,318608,318615,318619,318631,253111,253112,253113,253114,253115,253116,253117,253118,253119,253120,253121,253122,253123,253124,318661,318662,253125,318664,253126,318666,318667,318668,253127,253128,318671,253129,253130,253131,318675,253132,253133,253134,253135,318680,318681,318682,253138,253139,253140,318686,253142,253143,253144,253145,253146,253147,253148,253149,253150,253151,253152,253153,253154,253155,253156,253157,253158,253159,253160,253161,253162,318708,253164,318710,253166,253167,253168,253169,253170,253171,253172,253173,253174,318720,253176,253177,253178,253179,253180,253181,318727,318728,253184,253185,253186,253187,253188,253189,253190,253191,253192,253193,253194,253195,253196,253197,318743,318744,253200,253201,253202,253203,253204,253205,253206,253207,253208,253209,253210,318768,318813,318818,318821,318823,318827,318829,318831,318842,318844,253311,253312,253313,253314,318851,253315,318853,253316,253317,253318,253319,253320,253321,253322,253323,253324,253325,253326,253327,253328,253329,253330,253331,318870,318871,253332,253333,253334,318875,253335,318877,318878,253336,253337,253338,253339,253340,318884,253341,253342,253343,253344,253345,253346,253347,318892,253348,253349,253350,253351,253352,318898,253354,253355,253356,253357,253358,253359,318905,253361,253362,253363,253364,253365,253366,253367,253368,253369,253370,253371,253372,253373,253374,253375,253376,253377,253378,253379,253380,318926,253382,253383,253384,253385,253386,253387,253388,253389,318935,253391,253392,318938,253394,253395,253396,253397,253398,253399,253400,253401,253402,253403,253404,318950,253406,253407,253408,253409,253410,318956,318968,318971,318972,318973,318974,318975,318977,318983,318989,318990,318997,319008,319012,319024,319034,319035,319038,253511,319048,253512,319050,253513,253514,319053,253515,253516,253517,253518,253519,253520,253521,253522,253523,319063,253524,319065,253525,253526,253527,253528,253529,253530,253531,253532,319074,253533,253534,319077,319078,253535,253536,253537,319082,253538,253539,253540,319086,253542,253543,253544,253545,319091,253547,253548,253549,253550,253551,253552,253553,253554,253555,253556,319102,253558,253559,253560,253561,253562,319108,253564,253565,253566,253567,253568,253569,253570,253571,253572,253573,253574,253575,253576,253577,253578,253579,253580,253581,253582,253583,253584,253585,253586,253587,253588,253589,253590,253591,253592,253593,253594,253595,253596,253597,319143,253599,253600,253601,319147,253603,319149,253605,253606,253607,253608,253609,253610,319166,319173,319178,319182,319184,319231,319239,319240,319245,253711,253712,253713,319250,253714,253715,253716,253717,253718,253719,253720,253721,253722,253723,253724,253725,253726,253727,253728,253729,253730,253731,319269,253732,253733,253734,253735,253736,319275,253737,253738,253739,319279,253740,253741,253742,253743,319285,253744,253745,253746,253747,253748,253749,319292,253750,253751,253752,253753,253754,253755,253756,253757,253758,253759,319303,253760,253761,253762,253763,253764,253765,253766,319311,253767,253768,253769,253770,253771,253772,253773,253774,253775,253776,253777,253778,253779,253780,319326,319327,253783,253784,253785,253786,253787,253788,319334,253790,253791,253792,253793,253794,253795,319341,319342,253798,253799,253800,253801,253802,319348,253804,253805,319351,253807,319353,253809,253810,319356,319357,319361,319364,319370,319374,319379,319384,319396,319397,319406,319408,319411,319419,319421,319428,319435,319438,319440,319441,319450,319460,319461,319462,319463,319472,319482,319483,319490,319499,319539,319547,254011,254012,254013,254014]) UNION SELECT target_chain_id FROM event_auth_chain_links INNER JOIN links ON (chain_id = origin_chain_id))SELECT origin_chain_id, origin_sequence_number,target_chain_id, target_sequence_number FROM links INNER JOIN event_auth_chain_links ON (chain_id = origin_chain_id); |
I'm running 1.120.2 and randomly get the same issue. It just happened to me. @parisni Is it a coincidence that you just commented on this issue less than 20 minutes ago, or did you also experience this at the same time as I did ? (See the graph below, time is UTC+1) It seems the RAM usage of my postgres container started to rise shorlty before the CPU did. |
a coincidence that you just commented on this issue less than 20 minutes ago, or did you also experience this at the same time as I did
We definitely had the same issue at the same time. Not sure if it's independant. I have no idea what kind of action triggers this recursive query.
…On December 10, 2024 5:06:01 PM GMT+01:00, Pierre Couy ***@***.***> wrote:
I'm running 1.120.2 and randomly get the same issue. It just happened
to me. @parisni Is it a coincidence that you just commented on this
issue less than 20 minutes ago, or did you also experience this at the
same time as I did ?
![2024-12-10-170256_614x597_scrot](https://github.com/user-attachments/assets/179ed6c8-4dc0-42bd-87d2-c74945ced2f8)
It seems the RAM usage of my postgres container started to rise shorlty
before the CPU did.
|
This is a strong indicator that it was triggered by a cause external to our servers. I checked my synapse log but could not find any particularly weird line in all the noise. I'm not sure if this is caused by a single server acting funny (either old, misconfigured or malicious) or if the federation kind of collectively caused it. Since we both had it happen at the same time, I would be very interested to hear from people to whom it did NOT happen at the same time. There is probably something to learn about what triggers it by understanding the differences between impacted and not-impacted servers. (maybe we should create a room for server admins dedicated to tracking and sharing when this happens) |
@pcouy having the issue right now |
Description
The CPU usage of my server started to increase after no particular action on my end. After digging a little, I did find that the
get_auth_chain_ids_chains
transaction started to take a lot more time that previously.Synapse exporter:
Postgres exporter:
Steps to reproduce
Homeserver
club1.fr
Synapse Version
1.103.0
Installation Method
Debian packages from packages.matrix.org
Database
PostgreSQL single server, restored from a backup
Workers
Single process
Platform
Linux club1.fr 5.10.0-31-amd64 #1 SMP Debian 5.10.221-1 (2024-07-14) x86_64 GNU/Linux
Configuration
Definitely some unusual config:
Relevant log output
Anything else that would be useful to know?
No response
The text was updated successfully, but these errors were encountered: