matrix-appservice-discord icon indicating copy to clipboard operation
matrix-appservice-discord copied to clipboard

[M -> D] "Processing transaction" resets to 1 if homeserver returns error; Breaks matrix to discord bridging

Open msglm opened this issue 2 years ago • 3 comments

The bridging of messages between matrix and discord randomly fails and I believe it has to do with the attached error. The Matrix side simply doesn't listen at all, not even responding to !discord bridge. ~~Only known solution is deleting discord.db, but that unbridges all rooms and they must be manually re-bridged since portal bridging doesn't work and there is no way to easily bridge an entire discord guild.~~ See this reply for a hack to fix this.

Oct-21 23:24:21.217 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing transaction 17992' ]
Oct-21 23:24:21.219 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing event of type m.room.message' ]
Oct-21 23:24:21.225 [bot-sdkAppservice] ESC[32minfoESC[39m: [
  '127.0.0.1 - - [21/Oct/2022:23:24:21 +0000] "PUT /transactions/17992?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.68.0"\n'
]
Oct-21 23:27:06.660 [bot-sdkMatrixHttpClient] ESC[31merrorESC[39m: [
  '(REQ-3977225)',
  '<html>\r\n' +
    '<head><title>502 Bad Gateway</title></head>\r\n' +
    '<body>\r\n' +
    '<center><h1>502 Bad Gateway</h1></center>\r\n' +
    '<hr><center>nginx/1.18.0</center>\r\n' +
    '</body>\r\n' +
    '</html>\r\n'
]
Oct-21 23:27:06.685 [PresenceHandler] ESC[33mwarnESC[39m: Could not update Matrix presence for 481882841370853398
Oct-21 23:27:07.139 [bot-sdkMatrixHttpClient] ESC[31merrorESC[39m: [
  '(REQ-3977226)',
  '<html>\r\n' +
    '<head><title>502 Bad Gateway</title></head>\r\n' +
    '<body>\r\n' +
    '<center><h1>502 Bad Gateway</h1></center>\r\n' +
    '<hr><center>nginx/1.18.0</center>\r\n' +
    '</body>\r\n' +
    '</html>\r\n'
]
 . . . (much of the same)

Oct-21 23:30:15.429 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing transaction 1' ]
Oct-21 23:30:15.430 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing event of type m.room.message' ]
Oct-21 23:30:15.444 [bot-sdkAppservice] ESC[32minfoESC[39m: [
  '127.0.0.1 - - [21/Oct/2022:23:30:15 +0000] "PUT /transactions/1?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.69.0"\n'
]
Oct-21 23:33:48.711 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing transaction 2' ]
Oct-21 23:33:48.713 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing event of type m.room.message' ]
Oct-21 23:33:48.721 [bot-sdkAppservice] ESC[32minfoESC[39m: [
  '127.0.0.1 - - [21/Oct/2022:23:33:48 +0000] "PUT /transactions/2?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.69.0"\n'
]
Oct-21 23:34:08.318 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing transaction 3' ]
Oct-21 23:34:08.319 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing event of type m.room.message' ]
Oct-21 23:34:08.323 [bot-sdkAppservice] ESC[32minfoESC[39m: [
  '127.0.0.1 - - [21/Oct/2022:23:34:08 +0000] "PUT /transactions/3?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.69.0"\n'
]
Oct-21 23:40:47.868 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing transaction 4' ]
Oct-21 23:40:47.872 [bot-sdkAppservice] ESC[32minfoESC[39m: [ 'Processing event of type m.room.message' ]
Oct-21 23:40:47.881 [bot-sdkAppservice] ESC[32minfoESC[39m: [
  '127.0.0.1 - - [21/Oct/2022:23:40:47 +0000] "PUT /transactions/4?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Synapse/1.69.0"\n'
]

msglm avatar Oct 23 '22 16:10 msglm

checked my matrix homeserver logs to confirm this. The homeserver was restarted due to an update and this broke the bridge.

msglm avatar Oct 23 '22 16:10 msglm

Hi! this issue seems similar to an issue that i found; you may be experiencing the same problem. If so, no need to delete the full db file! See the other issue for more information. Feel free to ask about resetting transactionIds on matrix or github :)

Vyquos avatar Oct 24 '22 00:10 Vyquos

The above fix worked! All I had to do was dump the as_txns table and everything went back to normal. It's a good hack for now.

msglm avatar Oct 30 '22 09:10 msglm