platformio / platformio/platformio-core
`pio remote device list` takes over 7 minutes to complete after an agent drops from network
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.5k
- Forks
- 905
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
Description
Configuration
Operating system: 16.04 LTS
PlatformIO Version (platformio --version): PlatformIO, version 4.3.4
Description of problem
In normal operation, running pio remote device list takes about 2 seconds. However, if one of the agents is dropped from the network (e.g. loses internet connection, or suffers a power outage), suddenly pio remote device list blocks for over 7 minutes!
Steps to Reproduce
- On 2 remote computers:
- Log in to your account with
pio account login - Then start agents with
pio remote agent start
- Log in to your account with
- On a local computer:
- Log in to your account with
pio account login - Execute
pio remote device list - Verify that the response shows 2 remote agents (and also some devices which will depend on your remote computer hardware, unimportant)
- Log in to your account with
- Disconnect one of the remote computers from the internet
- On the local computer execute
pio remote device listagain
Actual Results
Results take extremely long time to arrive.
There is also a red error message at the top:
[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
]
The results are correct despite the error, though. They show the one remaining agent and its devices.
Expected Results
Results should be displayed within a few seconds and without the error message.
Additional info
pio remote agent list appears to not suffer from this problem, although it continues to show the dropped agent for roughly the same duration of time (I measured 5 minutes).
Showing the issue using time
cabox@Ubuntu:~/workspace$ time pio remote device list
Agent Prgm-de32
===============
/dev/ttyAMA0
------------
Hardware ID: 3f201000.serial
Description: ttyAMA0
Agent Prgm-61da
===============
/dev/ttyUSB0
------------
Hardware ID: USB VID:PID=10C4:EA60 SER=0001 LOCATION=1-1
Description: CP2102 USB to UART Bridge Controller
/dev/ttyAMA0
------------
Hardware ID: 20201000.serial
Description: ttyAMA0
Agent Prgm-1609
===============
/dev/ttyAMA0
------------
Hardware ID: 20201000.serial
Description: ttyAMA0
Agent Prgm-4cea
===============
/dev/ttyAMA0
------------
Hardware ID: 20201000.serial
Description: ttyAMA0
real 0m2.214s
user 0m0.504s
sys 0m0.079s
cabox@Ubuntu:~/workspace$ # DISCONNECTED DEVICE WITH "Prgm-1609" AGENT
cabox@Ubuntu:~/workspace$ # THEN RUNNING THE SAME COMMAND AGAIN:
cabox@Ubuntu:~/workspace$ time pio remote device list
[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
]
Agent Prgm-de32
===============
/dev/ttyAMA0
------------
Hardware ID: 3f201000.serial
Description: ttyAMA0
Agent Prgm-61da
===============
/dev/ttyUSB0
------------
Hardware ID: USB VID:PID=10C4:EA60 SER=0001 LOCATION=1-1
Description: CP2102 USB to UART Bridge Controller
/dev/ttyAMA0
------------
Hardware ID: 20201000.serial
Description: ttyAMA0
Agent Prgm-4cea
===============
/dev/ttyAMA0
------------
Hardware ID: 20201000.serial
Description: ttyAMA0
real 7m9.390s
user 0m0.534s
sys 0m0.085s
Note that the command took 2.2 seconds to run the first time and 7m9s the second time.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing pio remote device list with one remote agent disconnected, comparing its timing and output with the connected case. Trace the remote device-list and agent-connection handling; done means the command returns within a few seconds and does not print the reported connection error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100