Skip to content

Processor time continues to be used after a failing connect command #136

@ghost

Description

I'm trying to write a small script that isn't guaranteed to have internet access on startup and can sometimes lose internet unexpectedly.

When there is no internet, the socket will fail to connect (as expected) due to name resolution not being available. A socket error is raised.
If connect is called again, the error will be raised again, but the processor utilization will increase.
This will continue to occur until the operating system denies you the ability to create threads.

e.x.

while True:
    try:
        mqttclient.connect()
        break
    except:
        sleep(10)
        continue

Things I've tried:

  • Calling disconnect after a failed connect
  • Only calling connect once. Once internet is established, publish never works
  • Deleting mqttclient and re-creating it

Connect will have to be called again, since socket lifetimes are limited to 24 hours.
Related: #39 #124

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions