PIO Remote Agent Connection Lost When Running Multiple Agents

I’m planning on using the PIO remote agent to update a Adafruit M0 or M4 Feather Express connected to a Raspberry Pi 4 B running Buster. I’m running into an issue when running multiple agents at the same time on different Raspberry Pi 4s. When one agent is running, the agent authenticates to PIO Cloud. I’m able to upload firmware using the ‘pio remote run --target upload’ command. Next when I start two or more agents the connection to PIO Cloud is intermittent. It appears that as one agent authenticates the other agents are kicked off. Another agent re-authenticates and the other two are kicked off.

Has anyone encountered this situation before?

I’m not sure what the next troubleshooting step should be.

Here are some more details of my setup:

  • pio v 4.0.3
  • Agent running on Raspberry Pi 4B running Buster
  • Adafruit M0 or M4 Feather Express connected to USB port
  • 3 RPIs with connected Feather Expresses running on same wifi network
  • Platform IO Authentication Token setup as an environment variable and is visible using printenv command
  • When pio run --target upload is run separately on each RPI firmware uploads are successful
  • pio agent is running in foreground, since I’m still testing the configuration out. I later plan to run pio agent as a systemd service.

Below are the logs from the agents running in the foreground with synchronized timestamps. First I start the agent on and the connection is stable. Next I start the agent on and the connection on both agents starts an authentication loop. Next I start the agent on and the connection on all three agents loop. Then I stop the agent on and the connection on and loop. Then I stop the agent on and the connection on is stable again.


: pio remote agent start
PIO Plus v2.5.5
2019-10-11 10:26:34 [info] Name:
2019-10-11 10:26:34 [info] Connecting to PIO Remote Cloud
2019-10-11 10:26:35 [info] Successfully connected
2019-10-11 10:26:35 [info] Authenticating
2019-10-11 10:26:35 [info] Successfully authorized
2019-10-11 10:26:55 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:26:58 [info] Successfully connected
2019-10-11 10:26:58 [info] Authenticating
2019-10-11 10:26:59 [info] Successfully authorized
2019-10-11 10:27:10 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:13 [info] Successfully connected
2019-10-11 10:27:13 [info] Authenticating
2019-10-11 10:27:13 [info] Successfully authorized
2019-10-11 10:27:15 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:18 [info] Successfully connected
2019-10-11 10:27:18 [info] Authenticating
2019-10-11 10:27:19 [info] Successfully authorized
2019-10-11 10:27:23 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:26 [info] Successfully connected
2019-10-11 10:27:26 [info] Authenticating
2019-10-11 10:27:27 [info] Successfully authorized
2019-10-11 10:27:31 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:34 [info] Successfully connected
2019-10-11 10:27:34 [info] Authenticating
2019-10-11 10:27:35 [info] Successfully authorized


: pio remote agent start
PIO Plus v2.5.5
2019-10-11 10:26:49 [info] Name:
2019-10-11 10:26:49 [info] Connecting to PIO Remote Cloud
2019-10-11 10:26:54 [info] Successfully connected
2019-10-11 10:26:54 [info] Authenticating
2019-10-11 10:26:55 [info] Successfully authorized
2019-10-11 10:26:59 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:03 [info] Successfully connected
2019-10-11 10:27:03 [info] Authenticating
2019-10-11 10:27:09 [info] Successfully authorized
2019-10-11 10:27:13 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:22 [info] Successfully connected
2019-10-11 10:27:22 [info] Authenticating
2019-10-11 10:27:23 [info] Successfully authorized
2019-10-11 10:27:23 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:36 [warn] Could not connect to PIO Remote Cloud. Reconnecting…
^C
Aborted!


: pio remote agent start
PIO Plus v2.5.5
2019-10-11 10:27:14 [info] Name:
2019-10-11 10:27:14 [info] Connecting to PIO Remote Cloud
2019-10-11 10:27:14 [info] Successfully connected
2019-10-11 10:27:14 [info] Authenticating
2019-10-11 10:27:15 [info] Successfully authorized
2019-10-11 10:27:19 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:23 [info] Successfully connected
2019-10-11 10:27:23 [info] Authenticating
2019-10-11 10:27:23 [info] Successfully authorized
2019-10-11 10:27:27 [warn] Connection is lost to PIO Remote Cloud. Reconnecting
2019-10-11 10:27:30 [info] Successfully connected
2019-10-11 10:27:30 [info] Authenticating
2019-10-11 10:27:31 [info] Successfully authorized
^C2019-10-11 10:27:35 [info] Successfully disconnected

Aborted!

What is your PIO Account email? You send it here to private message.

@ivankravets - Sadly I can’t figure out how to send you a private message. Can you send a link on how to do that within the PIO community? I would prefer not to post my email publicly.

Thanks!

Mehul

When you click on his profile picture, you get the Message button.

1 Like

@maxgerhardt - I think you need to be signed in for the “Message” button to show up. I didn’t realize that. Thanks!

1 Like

I’m having the exact same problem with 2x raspberry pi 3+, was there a resolution to this issue?

@jxsavage - Privately @ivankravets told me to check the ~/.platformio/appstate.json files. In my case the ‘cid’ values were the same on both RPIs. The ‘cid’ value are the device Mac addresses. I believe this occurred because I created a template image with pio installed and then made copies of it for several RPIs. @ivankravets recommended " Could you remove appstate.json on the both devices and run, for example, pio device list command. The “cid” should be different. Otherwise, we can’t link 2 hardware to our PIO Cloud."

The direction of my project change so haven’t needed pio cloud, so I never tested out the procedure.

Hopefully this helps. Best of luck.

1 Like

@mgandhi Thank you!

That fixed my issue, Appreciate the help.

1 Like