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

Problems with matter when running parallel to webpage hosting - mdns hostname (CON-1055) #847

Closed
S-A-M-J opened this issue Feb 22, 2024 · 8 comments

Comments

@S-A-M-J
Copy link

S-A-M-J commented Feb 22, 2024

Describe the bug
esp fails to initialize and use advertiser

Environment

  • ESP-Matter Commit Id:
  • ESP-IDF Commit Id:
  • SoC: ESP32C3
  • Device Logs (Please attach the log file):
  • Host Machine OS: MacOs

Hi, i have code that hosts a webpage on a network in STA mode (esp is client in network and is hosting a webpage). On this webpage there is a button that if clicked turns matter on and makes the device discoverable and and controllable through matter while keeping the input possibility from the hosted webpage. Now at this point there are two tasks running. One with the webpage stuff with idlestatus priority and another one that starts the matter part that has priority idle + 1.
When i start matter, i get the below added logs. With the chip tool i tried to connect to the esp with onnetwork pairing but it seems the device is not even found (nodeid and passcode are guaranteed correct). When using amazon alexa to discover the device, the device is found but Alexa tells me to enter wifi creds in a loop while never fully connecting. (2nd logs).

The code to start matter i used is err = esp_matter::start(app_event_cb);

Maybe someone here has an idea what exactly is going wrong or what i can change. The matter code is 99% based on the light example from esp-matter.

1.pdf
2.pdf

@github-actions github-actions bot changed the title Problems with matter when running parallel to webpage hosting Problems with matter when running parallel to webpage hosting (CON-1055) Feb 22, 2024
@wqx6
Copy link
Contributor

wqx6 commented Feb 23, 2024

Hi, the logs show a LwIP error ERR_USE(-8). It means that the mDNS port(5353) of minimal mDNS was used by another pcb. Could you check whether you are using the mdns component https://github.com/espressif/esp-protocols/tree/master/components/mdns? If yes and you are not going to remove it, please disable minimal mDNS and use platform mDNS instead.

CONFIG_USE_MINIMAL_MDNS=n

@S-A-M-J
Copy link
Author

S-A-M-J commented Feb 25, 2024

Perfect thank you. Yes i was using the mdns component for the webpage hosting. Turning off the minimal dns actually got rid of the issue. I'm assuming by platform mdns you are referring to the mentioned component? And how did you connect the error code to mdns? i wasnt able to find a list of the error codes.
However now the esp seems to be impossible to find as a matter device, though there are no more errors. Could this be related to turning off minimal mdns or is it as i suspect unrelated?

@wqx6
Copy link
Contributor

wqx6 commented Feb 26, 2024

I'm assuming by platform mdns you are referring to the mentioned component

Yes, the platform mdns is using the mdns component I mentioned.

And how did you connect the error code to mdns? i wasnt able to find a list of the error codes.

The logs say E (29017) chip[DIS]: Failed to initialize advertiser: 3000008. It is from the minimal mDNS part and the error code is 0x3000008. The range is 0x3 so it's a LwIP error. And the LwIP error code is -8(ERR_USE). Normally it happens when a port is duplicately used. But 5353 is a special port for mDNS. So I guess that you are using mdns component.

However now the esp seems to be impossible to find as a matter device, though there are no more errors. Could this be related to turning off minimal mdns or is it as i suspect unrelated?

Maybe you can try to resolve the operational node service and see whether the service is advertised by your device? Looks like there are some issues on the order of mdns component APIs calling.

@S-A-M-J
Copy link
Author

S-A-M-J commented Feb 28, 2024

Turns out the device was actually visible. Sry my mistake. Thank you for the explanation.
Everything works now but after 2-3 minutes the webserver will suddenly stop answering while the matter interface works just fine. I dont get this issue when i dont start matter and the webserver works indefinitely. Does anybody what the problem could be here? There are no errors given.

@S-A-M-J
Copy link
Author

S-A-M-J commented Feb 28, 2024

So some testing showed that the webserver only stops responding if i don't message it for more than a minute. If i contiously send messages with less time than 1 min between them it will keep responding.

Edit: fixed by keeping the tcp connection alive through continously sending update messages.

@S-A-M-J S-A-M-J closed this as completed Feb 29, 2024
@S-A-M-J S-A-M-J reopened this Feb 29, 2024
@S-A-M-J
Copy link
Author

S-A-M-J commented Feb 29, 2024

Unfortunately not closed yet. While keeping the connection alive with pings works, once i close the web tab and open a new to connect to the webserver it is unresponsive again. It must have something to do with sessions being closed and unable to be reopened again but unfortunately i cant seem to find out exactly what.

@S-A-M-J
Copy link
Author

S-A-M-J commented Feb 29, 2024

Turns out this is again, as assumed, an mdns issue. Once matter is started the previously defined mdns based hostname is lost and cant be resolved but the webserver is still reachable via its ip address. Is there a way to keep the mdns hostname while using matter or is it impossible as matter needs to redeclare the mdns hostname to something different?

@S-A-M-J
Copy link
Author

S-A-M-J commented Mar 3, 2024

So i found out that there is no way to keep the hostname.

@S-A-M-J S-A-M-J closed this as completed Mar 3, 2024
@S-A-M-J S-A-M-J changed the title Problems with matter when running parallel to webpage hosting (CON-1055) Problems with matter when running parallel to webpage hosting - mdns hostname (CON-1055) Mar 3, 2024
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

2 participants