Skip to content

mDNS safe mode - find #6186

@anecdata

Description

@anecdata

CircuitPython version

Adafruit CircuitPython 7.3.0-alpha.0-52-g4465adfe0 on 2022-03-21; FeatherS2 with ESP32S2
(this is the version that corresponds to the mDNS merge)

Code/REPL

import wifi
import mdns
from secrets import secrets

print(" Connecting", end="\r")
wifi.radio.connect(secrets['ssid'], secrets['password'])
print(wifi.radio.ipv4_address)

print("Starting mDNS server...")
server = mdns.Server(wifi.radio)
service_types = ("_http", )

protocols = ("_tcp", )
for service_type in service_types:
    print(service_type, end=" ")
    for protocol in protocols:
        print(protocol)
        remote_service_tuple = server.find(service_type=service_type, protocol=protocol, timeout=5)
        for remote_service in remote_service_tuple:
            print(remote_service.hostname, remote_service.instance_name, remote_service.service_type, remote_service.protocol, remote_service.port)

Behavior

The example code probably works in many environments, but Safe Mode occurs when substituting many other service types and protocols. Hypothesis is there are no results for that combination.

code.py output:
Connected.    
Starting mDNS server...
_upnp _udp

[tio 21:28:16] Disconnected
[tio 21:28:20] Connected
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at 
https://github.com/adafruit/circuitpython/issues

Press any key to enter the REPL. Use CTRL-D to reload.

Description

Pattern seems to be Safe Mode when trying to find a service type and protocol that do not exist on the network.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions