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

Appservice incorrectly handling a batch of events with the same transaction ID #2718

Closed
tak-hntlabs opened this issue Sep 14, 2022 · 0 comments

Comments

@tak-hntlabs
Copy link
Contributor

tak-hntlabs commented Sep 14, 2022

Background information

  • Dendrite version or git SHA: 0ea948c (latest main on 9/14)
  • Monolith or Polylith?: Monolith
  • SQLite3 or Postgres?: SQLite3
  • Running in Docker?: No
  • go version: go version go1.19 darwin/amd64
  • Client used (if applicable):

Description

  • What is the problem:

I am seeing a regression with appservice. I am working on an appservice that uses the matrix-bot-sdk. My appservice was working prior to this PR that was merged: Refactor appservices component

Before the PR was merged, my appservice is able to see all events associated with a new space/ room creation. When a space is created, it was able to see all the related events - room.create, room.join, etc. After pulling the latest main, the appservice is no longer able to see the events when a space is created.

I traced it to this logic in appservice/consumers/roomserver.go. In line 178 of the func sendEvents( ... ):

txnID := events[0].Event.OriginServerTS()

What's happening is that the batch of events associated with space / room creation has the same OriginServerTS(). Dendrite sends the first event to the appservice. The appservice processes the event, and completes the transaction. The sendEvents func is invoked again with the rest of the events. The txnID is exactly the same as before. Consequently, the appservice thinks that this transaction has been processed, and ignores the events.

  • Who is affected:
    I am building on matrix-bot-sdk. This regression could affect any projects using that sdk. Didn't try other appservice sdk.

  • How is this bug manifesting:
    Configure an appservice (based on matrix-bot-sdk). Create a space or a room. Appservice no longer gets all the associated events with creating the room.

  • When did this first appear:
    After this PR was merged: Refactor appservices component

I will create a PR for fixing it. Will gather feedback in the PR.

tak-hntlabs added a commit to tak-hntlabs/dendrite that referenced this issue Sep 14, 2022
tak-hntlabs added a commit to HereNotThere/dendrite that referenced this issue Sep 14, 2022
tak-hntlabs added a commit to HereNotThere/dendrite that referenced this issue Sep 15, 2022
)

* temporary fix for dendrite regression matrix-org#2718

* Change comment to match with dendrite main pr

* renamed zion-registration.yaml to zion-appservice.yaml. Change gitignore to ignore this file.

Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
tak-hntlabs added a commit to HereNotThere/dendrite that referenced this issue Sep 16, 2022
tak-hntlabs added a commit to HereNotThere/dendrite that referenced this issue Sep 16, 2022
Co-authored-by: Tak Wai Wong <tak@hntlabs.com>
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

No branches or pull requests

1 participant