letsfindaway / OpenBoard

I'm using this fork to contribute features and fixes to the upstream project. In order to create good pull requests, I'm rebasing my feature branches, squashing and reordering commits, etc. If you fork this repository be aware that my development branches may rewrite history without prior notice.
http://openboard.ch/
GNU General Public License v3.0
9 stars 0 forks source link

Error messages in normal session #130

Closed letsfindaway closed 1 year ago

letsfindaway commented 1 year ago

A very simple OpenBoard session where I just drag the Horologe widget to an empty board yields the following log output. Note that I have removed lines and only left one line before and after an error message. I also added markers to the error messages:

...
userDocumentDirectory() "/home/family/.local/share/OpenBoard/document"
=> [1] Invalid path data; path truncated.
process starts
...
control geometry QRect(0,0 1920x1080)
=> [2] Uncaught TypeError: Cannot read property 'innerHTML' of undefined
=> [3] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Checking for update at url:  "http://www.openboard.ch/update.json"
...
something has been dropped on the board! Url is:  "file:///home/family/Dokumente/Martin/letsfindaway/build-OpenBoard-qt6-Desktop-Debug/install/usr/share/openboard/library/applications/Horloge.wgt"
=> [4] QIODevice::read (QFile, "/home/family/Dokumente/Martin/letsfindaway/build-OpenBoard-qt6-Desktop-Debug/install/usr/share/openboard/library/applications/Horloge.wgt"): device not open
accepting mime type "application/widget" as W3C widget
...
stop waiting after  17  ms
=> [5] [4653:7:0515/072126.110575:ERROR:command_buffer_proxy_impl.cc(141)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
=> [6] Release of profile requested but WebEnginePage still not deleted. Expect troubles !
=> [6] Release of profile requested but WebEnginePage still not deleted. Expect troubles !

None of the problems affect the user, but having them in the log file may point to possible errors. Let me analyze them:

[1] Invalid path data

This error is logged when loading the library/pictures/Worldmap_wdb_combined.svg icon. It happens because the complexity of the path in this file is too big. See https://github.com/qt/qtsvg/blob/8e2e5bae5569c18834129679f6db2f53ad7cbb25/src/svg/qsvghandler.cpp#L1560-L1562: If there are more than 0x7fff (32767) path elements this is considered to be an error. The world map however has about 46000 path elements in a single path.

The consequence is also that Australia and the south pole are missing from the image when dragged to the board.

[2] Uncaught TypeError

This happens when loading the "Hints and tips":

Uncaught TypeError: Cannot read property 'innerHTML' of undefined
    at setTitle (index.html:63)
    at HTMLIFrameElement.onload (index.html:70)

The code is the following: https://github.com/letsfindaway/OpenBoard/blob/53f7f58de0cf60303288762146ac7bb71351e525/resources/startupHints/index.html#L61-L64

When further analyzing this I can see that at the point of this error iframe.contentWindow.document contains the URL about:blank, which of course has no title.

[3] Synchronous XMLHttpRequest

This happens due to the way how the Hints and tips count the number of available pages for a language. As there is no direct access to the file system in JS, POST requests are issued to check existence of the files. These requests are issued synchronously: https://github.com/letsfindaway/OpenBoard/blob/53f7f58de0cf60303288762146ac7bb71351e525/resources/startupHints/index.html#L14-L31

See async: false.

[4] QIODevice::read

Here just the log message should be improved. It only tells that the dropped entity is not a file, but a directory.

[5] ERROR:command_buffer_proxy_impl.cc

Difficult to locate. Probably a consequence of the next?

[6] Release of profile requested

This happens because while closing two more QWebEnginePage instances are created. The first here:

1   UBWebEngineView::UBWebEngineView                        UBWebEngineView.cpp      43   0x63f62e       
2   UBGraphicsWidgetItem::UBGraphicsWidgetItem              UBGraphicsWidgetItem.cpp 78   0x62d37f       
3   UBGraphicsW3CWidgetItem::UBGraphicsW3CWidgetItem        UBGraphicsWidgetItem.cpp 894  0x631bdd       
4   UBGraphicsW3CWidgetItem::deepCopy                       UBGraphicsWidgetItem.cpp 1049 0x633ee3       
5   UBGraphicsScene::sceneDeepCopy                          UBGraphicsScene.cpp      1419 0x60e9c2       
6   UBPersistenceManager::persistDocumentScene              UBPersistenceManager.cpp 1166 0x57a519       
7   UBBoardController::persistCurrentScene                  UBBoardController.cpp    2040 0x521b4e       
8   UBBoardController::lastWindowClosed                     UBBoardController.cpp    1948 0x521522       
9   UBBoardController::closing                              UBBoardController.cpp    1928 0x521451       
10  UBApplication::closing                                  UBApplication.cpp        514  0x551419       

and the second here:

1  UBWebEngineView::UBWebEngineView                                UBWebEngineView.cpp      43   0x63f62e 
2  UBGraphicsWidgetItem::UBGraphicsWidgetItem                      UBGraphicsWidgetItem.cpp 78   0x62d37f 
3  UBGraphicsW3CWidgetItem::UBGraphicsW3CWidgetItem                UBGraphicsWidgetItem.cpp 894  0x631bdd 
4  UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsW3CWidgetFromSvg UBSvgSubsetAdaptor.cpp   2674 0x4f86ab 
5  UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene                UBSvgSubsetAdaptor.cpp   889  0x4e65df 
6  UBSvgSubsetAdaptor::loadScene                                   UBSvgSubsetAdaptor.cpp   349  0x4e2e1c 
7  UBSvgSubsetAdaptor::loadScene                                   UBSvgSubsetAdaptor.cpp   265  0x4e2310 
8  UBPersistenceManager::isEmpty                                   UBPersistenceManager.cpp 1330 0x57bf0a 
9  UBPersistenceManager::purgeEmptyDocuments                       UBPersistenceManager.cpp 1354 0x57bff7 
10 UBBoardController::lastWindowClosed                             UBBoardController.cpp    1951 0x521539 
11 UBBoardController::closing                                      UBBoardController.cpp    1928 0x521451 
12 UBApplication::closing                                          UBApplication.cpp        514  0x551419 
letsfindaway commented 1 year ago

[1] Invalid path data

To fix this issue, I processed the image in Inkscape, splitting the path into pieces. From that I created the new file Worldmap_wdb_splitted.svg.

Now the error message is gone and also Australia and the South Pole appear ;)

letsfindaway commented 1 year ago

[2] Uncaught TypeError

Here a simple check will help: Only try to change the title if it exists.

letsfindaway commented 1 year ago

[3] Synchronous XMLHttpRequest

This can be solved by using asynchronous requests and waiting for them using await.

letsfindaway commented 1 year ago

[4] QIODevice::read

We should not attempt to read a file if it cannot be opened.

For widgets, the URL points to a directory. However the UBBoardController tries to read the content. This fails and creates the error message. Subsequent processing is however correct.

I just add a test whether the file can be opened and only try to read the content if that is the case.

letsfindaway commented 1 year ago

[6] Release of profile requested

In UBPersistenceManager::persistDocumentScene a deep copy of a scene is created to pass it to an asynchronous worker. This also involves creating a new QWebEnginePage, if the scene contains a widget. Note that the deep copy is deleted in UBPersistenceManager::onScenePersisted, but not when closing the application. I think this check is wrong, we also have to delete it in this case.

However the second page mentioned above is created, but also correctly destroyed. Further investigations revealed that there is a scene remaining in the UBSceneCache which is not correctly deleted. We have to clear the cache when it is deleted.

letsfindaway commented 1 year ago

[5] ERROR:command_buffer_proxy_impl.cc

This problem vanished once [6] was fixed.

letsfindaway commented 1 year ago

closed as PR was merged