platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.9k stars 792 forks source link

Error on "remote upload" command #3320

Closed xilart closed 4 years ago

xilart commented 4 years ago

What kind of issue is this?

Configuration

Operating system: Server: Raspbian (stretch) Client: Win10\VSCode

PlatformIO Version (platformio --version): Server: PlatformIO, version 4.1.0 Client: PlatformIO, version 4.1.1b6

Description of problem

The problem persists with python3.7 (Win10-PC) on client and python3.5 (RPi). It's interesting that when I had mixed versions then "remote monitor" and "remote device" commands in PIO failed. Now "remote monitor" and "remote device" work fine, but once I try "remote upload" - it fails with two different error types.

Steps to Reproduce

Server

  1. Setup PIO CLI on server:
    apt-get install python3-venv
    python3 -m venv /var/env/python3
    source /var/env/python3/bin/activate
    pip install -U platformio
  2. Run agent:
    source /var/env/python3/bin/activate
    pio account login -u email@email.com -p 12345
    pio remote agent start --name rpi

Client:

  1. Open project in VSCode
  2. Run "Remote upload"

Actual Results

Client (VSCode) console reports an error:

Uploading firmware remotely
Agent has been terminated
The terminal process terminated with exit code: 1

Server reports an error:

2019-12-27 16:30:38 [info] Remote command received: psync
Peer will receive following PB traceback:
Unhandled Error
Traceback (most recent call last):
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 173, in gotItem
    self.callExpressionReceived(item)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 136, in callExpressionReceived
    self.expressionReceived(obj)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 621, in expressionReceived
    method(*sexp[1:])
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1025, in proto_message
    self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw)
--- <exception caught here> ---
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1054, in _recvMessage
    netResult = object.remoteMessageReceived(self, message, netArgs, netKw)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/flavors.py", line 125, in remoteMessageReceived
    state = method(*args, **kw)
  File "<string>", line 46, in remote_acwrite

  File "<string>", line 282, in ac_write

  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
builtins.TypeError: the JSON object must be str, not 'bytes'

The next attempt to run "Remote upload" reports another error:

Client:

Uploading firmware remotely
b'dictionary changed size during iteration'
The terminal process terminated with exit code: 1`

Server:

2019-12-27 16:28:47 [info] Remote command received: psync
2019-12-27 16:28:47 [info] Terminate previous Project Sync process
Peer will receive following PB traceback:
Unhandled Error
Traceback (most recent call last):
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 173, in gotItem
    self.callExpressionReceived(item)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/banana.py", line 136, in callExpressionReceived
    self.expressionReceived(obj)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 621, in expressionReceived
    method(*sexp[1:])
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1025, in proto_message
    self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw)
--- <exception caught here> ---
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/pb.py", line 1054, in _recvMessage
    netResult = object.remoteMessageReceived(self, message, netArgs, netKw)
  File "/root/.platformio/packages/contrib-pysite/twisted/spread/flavors.py", line 125, in remoteMessageReceived
    state = method(*args, **kw)
  File "<string>", line 60, in remote_cmd

  File "<string>", line 88, in _process_cmd_psync

builtins.RuntimeError: dictionary changed size during iteration

Expected Results

Build has to be uploaded to remote Arduino via PIO agent

Additional info

VSCode info:

Version: 1.41.1 (system setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363
ivankravets commented 4 years ago

Duplocate of https://github.com/platformio/platformio-core/issues/3344