danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
611 stars 216 forks source link

asammdf 7.4.2: Main GUI issues #994

Closed MatinF closed 3 months ago

MatinF commented 3 months ago

Hi Daniel,

I'm following up on the previous post to try and create a collection of key issues observed in the latest GUI. The GUI was downloaded via the Actions/ section on github (tested on Windows 10). My local system runs both Python 3.9 and Python 3.11 (the latter being the one in my PATH). Below is my pip freeze, though I would expect neither my Python version or dependencies should play any role for the pre-built GUI.

pipfreeze.txt

1: Unable to open database file causes crash when trying CAN bus trace

To replicate, simply load an MF4 and try to do a CAN bus trace. Note that this also happens if I open the GUI, delete the DBC files in the database manager and then try to create a CAN bus trace.

image

Error: <class 'sqlite3.OperationalError'>    
unable to open database file

Details: 2024-03-12, 16:13:40
--------------------------------------------------------------------------------
<class 'sqlite3.OperationalError'>   
unable to open database file
--------------------------------------------------------------------------------
  File "shibokensupport/signature/mapping.py", line 166, in update
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "spherogram\__init__.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "spherogram\links\__init__.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "spherogram\links\links.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module
  File "spherogram\links\links_base.py", line 42, in <module>
  File "snappy_manifolds\database.py", line 774, in get_DT_tables
  File "snappy_manifolds\database.py", line 760, in __init__
  File "snappy_manifolds\database.py", line 737, in connect_to_db

Creating 2 separate plot windows crashes the GUI

As reported before, simply creating two separate plot windows fails, see below video.

As mentioned I am unable to replicate this in a virtual environment with the pip install method, so somehow this appears linked to the GUI build.

As another, note, however, I also tried installing the release 7.4.2 via pip install and run the same steps as in the below video. Here I get an additional error output as parsed below. This was tested with the dependencies I have parsed above.

https://github.com/danielhrisca/asammdf/assets/26184427/b7e58a09-de41-4417-87e5-bfd0849a2f14

Error: <class 'RecursionError'>  
maximum recursion depth exceeded while calling a Python object

Details: 2024-03-12, 16:20:11
--------------------------------------------------------------------------------
<class 'RecursionError'>     
maximum recursion depth exceeded while calling a Python object
--------------------------------------------------------------------------------
  File "C:\Users\marti\AppData\Local\Programs\Python\Python311\Lib\site-packages\asammdf\gui\widgets\viewbox.py", line 95, in viewStateChanged
    self.updateState()
  File "C:\Users\marti\AppData\Local\Programs\Python\Python311\Lib\site-packages\asammdf\gui\widgets\viewbox.py", line 98, in updateState
    state = self.view().getState(copy=False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\marti\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyqtgraph\graphicsItems\ViewBox\ViewBox.py", line 327, in getState
    state = self.state.copy()
            ^^^^^^^^^^^^^^^^^
danielhrisca commented 3 months ago

Hello Martin,

I've switched back to PySide6==6.3.1 for the GUI builds. Please try them here https://github.com/danielhrisca/asammdf/actions/runs/8252192718

MatinF commented 3 months ago

Hi Daniel, this fixes the 1st issue, i.e. the CAN bus trace issue, though it does not seem to affect the 2nd part.

MatinF commented 3 months ago

I did some more testing via multiple venv installs.

1) I have confirmed that I can create a virtual environment and install older releases, specifically 7.3.15, 7.3.16 and 7.3.17, without encountering the plot window crash issue. I use the below command:

py -3.10 -m venv env & env\Scripts\activate & pip install asammdf[gui]==7.3.17 --no-cache-dir

2) However, if I then upgrade to 7.4.1 or 7.4.2 or the latest development release, I experience the plot window issue.

3) I tested this on Windows 10 with both Python 3.10 and Python 3.11. The behavior is fully consistent.

It thus seems related to something that was introduced between 7.3.17 and 7.4.1.

I have added my venv pip freeze below for the sake of good order, it's identical across 7.3.17 and 7.4.1 except for the asammdf version:

asammdf==7.3.17
attrs==23.2.0
canmatrix==1.0
click==8.1.7
colorama==0.4.6
future==1.0.0
isal==1.6.1
lxml==5.1.0
lz4==4.3.3
natsort==8.4.0
numexpr==2.9.0
numpy==1.26.4
packaging==24.0
pandas==2.2.1
psutil==5.9.8
pyqtgraph==0.13.3
pyqtlet2==0.9.3
PySide6==6.6.0
PySide6-Addons==6.6.0
PySide6-Essentials==6.6.0
python-dateutil==2.9.0.post0
pytz==2024.1
QtPy==2.3.1
shiboken6==6.6.0
six==1.16.0
typing_extensions==4.10.0
tzdata==2024.1
MatinF commented 3 months ago

To further debug this, I went ahead and installed the versions of asammdf between the "working" 7.3.17 and the "non-working" 7.4.1:

Specifically, I found that the issue seems to arise in the transition from 7.3.9 to 7.4.0.

More specifically I was not able to replicate the issue at all up to and including the below commit (7.3.19dev18): https://github.com/danielhrisca/asammdf/commit/3bd615204e59375d1a1b9fd2972b8a40069dd535

However, as I progress to test the next group of commits the plot window crashing starts to occur, though I am unsure which exact commit is causing it in the group starting from below. It is as-if the further I go through the group, the more consistently the crash occurs, i.e. the group starting from/to below:

https://github.com/danielhrisca/asammdf/commit/e6dbac3b24e5a68e0ad9161ccd34a0ff36691375 https://github.com/danielhrisca/asammdf/commit/9c986f7730418d57d7c973c36047859e15232fea

MatinF commented 3 months ago

Also, perhaps there is something to gain from the below error message I get when the issue arises in the testing above:

 File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\widgets\viewbox.py", line 95, in viewStateChanged
    self.updateState()
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\widgets\viewbox.py", line 98, in updateState
    state = self.view().getState(copy=False)
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\ViewBox\ViewBox.py", line 327, in getState
    state = self.state.copy()

<class 'RecursionError'>: maximum recursion depth exceeded while calling a Python object
2024-03-13, 13:20:48
--------------------------------------------------------------------------------
<class 'RecursionError'>
maximum recursion depth exceeded while calling a Python object
--------------------------------------------------------------------------------
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\widgets\viewbox.py", line 95, in viewStateChanged
    self.updateState()
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\widgets\viewbox.py", line 98, in updateState
    state = self.view().getState(copy=False)
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\ViewBox\ViewBox.py", line 327, in getState
    state = self.state.copy()

Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\utils.py", line 162, in excepthook
    now = datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
  File "shibokensupport/signature/loader.py", line 54, in feature_import
  File "shibokensupport/feature.py", line 89, in feature_import
RecursionError: maximum recursion depth exceeded while calling a Python object

Original exception was:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\InfiniteLine.py", line 336, in boundingRect
    self._boundingRect = self._computeBoundingRect()
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\widgets\cursor.py", line 361, in _computeBoundingRect
    vr = self.viewRect()  # bounds of containing ViewBox mapped to local coords.
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\GraphicsItem.py", line 179, in viewRect
    bounds = self.mapRectFromView(view.viewRect())
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\GraphicsItem.py", line 390, in mapRectFromView
    vt = self.viewTransform()
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\GraphicsItem.py", line 146, in viewTransform
    view = self.getViewBox()
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\GraphicsItem.py", line 117, in getViewBox
    return self._viewBox()  ## If we made it this far, _viewBox is definitely not None
RecursionError: maximum recursion depth exceeded while calling a Python object
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\utils.py", line 162, in excepthook
    now = datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
  File "shibokensupport/signature/loader.py", line 54, in feature_import
RecursionError: maximum recursion depth exceeded

Original exception was:
AttributeError: Slot 'ViewBoxMenu::viewStateChanged()' not found.
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\utils.py", line 162, in excepthook
    now = datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
  File "shibokensupport/signature/loader.py", line 54, in feature_import
RecursionError: maximum recursion depth exceeded

Original exception was:
AttributeError: Slot 'PlotItem::viewStateChanged()' not found.
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\utils.py", line 162, in excepthook
    now = datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
  File "shibokensupport/signature/loader.py", line 54, in feature_import
  File "shibokensupport/feature.py", line 89, in feature_import
RecursionError: maximum recursion depth exceeded while calling a Python object

Original exception was:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 611, in linkedViewChanged
    if self.orientation in ['right', 'left']:
RecursionError: maximum recursion depth exceeded in comparison
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\asammdf\gui\utils.py", line 162, in excepthook
    now = datetime.now().strftime("%Y-%m-%d, %H:%M:%S")
  File "shibokensupport/signature/loader.py", line 54, in feature_import
  File "shibokensupport/feature.py", line 89, in feature_import
RecursionError: maximum recursion depth exceeded while calling a Python object

Original exception was:
Traceback (most recent call last):
  File "C:\Users\marti\Documents\asammdf-venv\env\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 611, in linkedViewChanged
    if self.orientation in ['right', 'left']:
RecursionError: maximum recursion depth exceeded in comparison
MatinF commented 3 months ago

Hi Daniel,

Another update:

For the sake of good order, our team installed asammdf on another PC to verify that the issue is not unique to my PC. As expected, 7.4.2 also exhibits the plot window issue on the other PC.

One observation, however, is that it is possible to "avoid" the crash issue to some extent by not using the drag & drop functionality to create the new plot windows. If I use the more 'manual' method of clicking the plot button the crash does not occur, but as soon as I drag & drop a second plot, it crashes the GUI.

I assume this may be the reason why you're not seeing the issue on your PC - i.e. if you've used the 'manual' method instead of 'drag & drop'. I have illustrated this in below video:

https://github.com/danielhrisca/asammdf/assets/26184427/69206a7c-fd14-4f93-b3cb-bbe8aa41924c

MatinF commented 3 months ago

Closing as resolved in latest dev - thanks Daniel!