Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python trace when flashing #14

Open
pkubaj opened this issue Feb 26, 2024 · 4 comments
Open

Python trace when flashing #14

pkubaj opened this issue Feb 26, 2024 · 4 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@pkubaj
Copy link
Contributor

pkubaj commented Feb 26, 2024

This has appeared after the successful flashing:

pkubaj@3M04:~$ ~/.local/bin/osfv_cli rte --rte_ip 192.168.10.14 flash write --rom ~/coreboot/protectli_vp46xx_v1.2.0-rc2.rom
DUT model retrieved from snipeit: VP4670
Writing /home/pkubaj/coreboot/protectli_vp46xx_v1.2.0-rc2.rom to flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 -c MX25L12835F/MX25L12845E/MX25L12865E -w /tmp/write.rom
flashrom v1.2 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org


Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).

Found Macronix flash chip "MX25L12835F/MX25L12845E/MX25L12865E" (16384 kB, SPI) on linux_spi.

Reading old flash chip contents... 
done.
Erasing and writing flash chip... 
Erase/write done.
Verifying flash... 
VERIFIED.









Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 1423, in getresponse
    response.begin()
  File "/usr/lib64/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/socket.py", line 707, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 799, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 715, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 467, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/lib/python3.12/site-packages/urllib3/connectionpool.py", line 462, in _make_request
    httplib_response = conn.getresponse()
                       ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 1423, in getresponse
    response.begin()
  File "/usr/lib64/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 292, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/socket.py", line 707, in readinto
    return self._sock.recv_into(b)
           ^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pkubaj/.local/bin/osfv_cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/osfv_cli.py", line 731, in main
    flash_write(rte, args)
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/osfv_cli.py", line 235, in flash_write
    rte.flash_write(args.rom)
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/rte.py", line 234, in flash_write
    self.flash_cmd(args, write_file=write_file)
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/rte.py", line 204, in flash_cmd
    self.spi_disable()
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/rte.py", line 114, in spi_disable
    self.gpio_set(self.GPIO_SPI_ON, "high-z")
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/rtectrl_api.py", line 65, in gpio_set
    response = self._patch_request(f"/gpio/{gpio_no}", message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/osfv_cli/rtectrl_api.py", line 77, in _patch_request
    response = requests.patch(f"{url}{endpoint}", json=data, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/api.py", line 145, in patch
    return request("patch", url, data=data, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pkubaj/.local/lib/python3.12/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
@macpijan macpijan changed the title Error after successful flashing Python trace when flashing May 27, 2024
@macpijan
Copy link
Contributor

macpijan commented May 27, 2024

We have another similar report from @miczyg1 so I edited the issue description and put it here. This time it happened before the flashing has finished successful:

DUT model retrieved from snipeit: VP2420
Writing protectli_vp2420.rom to flash...
Traceback (most recent call last):
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/usr/lib64/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 300, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 536, in _make_request
    response = conn.getresponse()
               ^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 1428, in getresponse
    response.begin()
  File "/usr/lib64/python3.12/http/client.py", line 331, in begin
    version, status, reason = self._read_status()
                              ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/http/client.py", line 300, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/bin/osfv_cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/osfv_cli.py", line 759, in main
    flash_write(rte, args)
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/osfv_cli.py", line 252, in flash_write
    rte.flash_write(args.rom)
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rte.py", line 303, in flash_write
    self.flash_cmd(args, write_file=write_file)
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rte.py", line 228, in flash_cmd
    self.pwr_ctrl_before_flash(self.dut_data["programmer"]["name"])
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rte.py", line 211, in pwr_ctrl_before_flash
    self.spi_enable()
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rte.py", line 148, in spi_enable
    self.gpio_set(self.GPIO_SPI_VOLTAGE, state)
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rtectrl_api.py", line 65, in gpio_set
    response = self._patch_request(f"/gpio/{gpio_no}", message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/osfv_cli/rtectrl_api.py", line 77, in _patch_request
    response = requests.patch(f"{url}{endpoint}", json=data, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/api.py", line 145, in patch
    return request("patch", url, data=data, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miczyg/Projects/Dasharo/open-source-firmware-validation/venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

This looks similar enough that we could analyze both of these reports at the same time.

@macpijan macpijan added this to the v0.5.0 milestone Jun 10, 2024
@macpijan macpijan added bug Something isn't working good first issue Good for newcomers labels Jun 10, 2024
@macpijan
Copy link
Contributor

We should at least catch these exceptions and not print these traces to the end user.

@SebastianCzapla
Copy link
Contributor

#63

Fix to this issue has been merged in this PR.

@macpijan
Copy link
Contributor

#63 (comment)

@macpijan macpijan reopened this Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants