labgrid-project / labgrid-project/labgrid

Openocd no graceful shutdown, blocked ports and conflicts

Open
#1,016 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs author info
Dominant language
Python
Stars
528
Forks
278
Avg merge
2d 19h
Merged PRs (30d)
4

Description

The openocddriver opens and listens to multiple ports when started (except if last load command is shutdown) by the client.
If the openocdserver/gdbserver is waiting too long for a connection (gdb, telnet, udp) the client throws an error (i assume timeout).
This is not a problem on the client side, but the openocd server does not shut down correctly which leads to blocked ports or libusb access conflicts.
The same problems occur when the client terminates the command that started openocd on the remote machine (via keyboard interrupt).

When openocd is started locally (w/o labgrid), it invokes the "shutdown" command upon receiving SIGTERM, so all ports are closed properly.

Is there any way to implement a graceful shutdown remotely?

This is very annoying because the only way to regain access to the ports and avoid libusb conflicts is restarting the remote machine (or at least the coordinator and exporter).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the openocddriver lifecycle through the openocdserver/gdbserver and the coordinator/exporter, focusing on timeout and keyboard-interrupt paths and how SIGTERM is handled. Done means remote shutdown closes the OpenOCD ports and releases libusb access after failed connections or client termination.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.