Skip to content

restart jtop client -> BrokenPipeError: [Errno 32] Broken pipe#601

Description

@jeronimoagullo

This issue is related to the issue #261

I have the following code in python 3.10 with jtop 4.3.0:

import jtop

jetson = None

while True:
    try:
        if jetson is None:
            print("Initializing jtop client...")
            jetson = jtop.jtop()
            jetson.start()

        while jetson.ok():

            # Temperature
            temperatures = jetson.temperature
            temp_cpu = temperatures['cpu']['temp']
            temp_gpu = temperatures['gpu']['temp']
            print(f"Temperature CPU: {temp_cpu}潞C and GPU: {temp_gpu}潞C")

    except jtop.JtopException as e:
        print(f"Jtop error: {e}")
    except Exception as e:
        print(f"Error getting metrics: {e}")
    finally:
        try:
            jetson.close()  # Ensure the client is closed
        except Exception as close_error:
            print(f"Error while closing jtop client: {close_error}")
        jetson = None # Reset the reference                

It works correctly until I stop and start again the jtop.service with systemctl command. I know from issue #261 that the jtop client must be restarted so that the SyncManager is restarted. However, I cannot get it working once the jtop service restarts.

Are I missing something? What should be the correct approach to restart jtop client?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions