Skip to content

Fix flapping test - #1097

Closed
singpolyma wants to merge 2 commits into
xmppjs:mainfrom
singpolyma:fix-flapping-test
Closed

Fix flapping test#1097
singpolyma wants to merge 2 commits into
xmppjs:mainfrom
singpolyma:fix-flapping-test

Conversation

@singpolyma

Copy link
Copy Markdown
Contributor

Race condition between the timers and close (which happens first) vs disconnect (which happens after).

Race condition between the timers and close (which happens first) vs
disconnect (which happens after).
}

entity.on("disconnect", () => {
entity.on("close", () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

disconnect looks correct logicially to me here.

Please explain why this makes more sense than changing the test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After the stream has closed no more stanzas can be sent. If the timeout fires after close but before disconnect, it will try to send and that is what caused the problem. Now we correctly stop the timers at close so they cannot fire on a closed stream.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While investigating I realized there are 2 separate problems

First one is write after end

stream management shouldn't throw when attemtping to send stanzas if the stream or socket is closed

Image

Fixed by #1099

I'll get back to the second one later.

@singpolyma singpolyma Nov 12, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes this is the one fixed by this PR. I see from the current CI results there is another one

I'm a bit confused by this second one. It seems to be triggered by data coming in when there is no parser? But I'm not sure how that's possible. Maybe a race condition creating the parser after connect?

@sonnyp

sonnyp commented Nov 18, 2025

Copy link
Copy Markdown
Member

Fixed by #1099

Follow up: #1100

@sonnyp sonnyp closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants