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

Race condition when unpublishing service immediately after advertising #18

Open
Supereg opened this issue Nov 6, 2021 · 1 comment
Open
Labels
bug Something isn't working pinned

Comments

@Supereg
Copy link
Member

Supereg commented Nov 6, 2021

Describe The Bug:
When removing the advertisement for a ciao service immediately after advertising it, it may result in a race condition.
It seems like the Prober isn't properly canceled (or rather started after the service advertisement has already been ended).
Therefore the Prober accesses an already closed MDNSServer.

To Reproduce:

  1. Create a CiaoService service.
  2. Call service.advertise()
  3. Call service.destroy() or service()

Expected behavior:
The Responder should not start a probing step when the service was already unannounced.

Logs:

The reported error is as follows:

Cannot send packets on a closed mdns server!
ERR_SERVER_CLOSED: Cannot send packets on a closed mdns server!
    at MDNSServer.assertBeforeSend (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:403:13)
    at MDNSServer.sendOnAllNetworksForService (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:302:10)
    at MDNSServer.sendQueryBroadcast (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:263:26)
    at Prober.sendProbeRequest (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/responder/Prober.ts:165:17)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Environment:

  • Node.js Version: v17.0.1
  • NPM Version: 8.1.0
  • Ciao Version: 1.1.3
  • Operating System: macOS
@Supereg Supereg added bug Something isn't working pinned labels Nov 6, 2021
@oznu oznu closed this as completed in 12cd92c Apr 27, 2022
@Supereg Supereg reopened this Apr 27, 2022
@Supereg
Copy link
Member Author

Supereg commented Apr 27, 2022

Closed by accident.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pinned
Projects
None yet
Development

No branches or pull requests

1 participant