paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
17 stars 2 forks source link

Only one instance of project/resource will survive on restart #928

Closed Sebastian-ubs closed 2 months ago

Sebastian-ubs commented 4 months ago

Describe the bug When opening a scripture editor (project) or resource multiple times, only 1 of them will have content after restarting Platform.Bible. Console shows web-view.component failed to retrieve web view content for ... Error: "Timeout reached when waiting for wait-for-net-obj to settle" This happens at least since the reworked folder structure

Screenshots |opened projects| ![Screenshot 2024-06-06 100212](https://github.com/paranext/paranext-core/assets/141921979/c1cd2728-ff12-45b7-819e-27f0a33ae594) | | - | - | |after restarting platform| ![Screenshot 2024-06-06 100351](https://github.com/paranext/paranext-core/assets/141921979/5b2c9afd-2294-4da0-97f1-3848098850c5) | |console| ![Screenshot 2024-06-06 100435](https://github.com/paranext/paranext-core/assets/141921979/5558e3f9-336b-4e25-8a7f-d37710e44995) |

To Reproduce

  1. Put projects into the new folder structure <user>\.platform.bible\projects\Paratext 9 Projects
  2. Start Platform
  3. Open them twice with "open scripture editor" or "open resource viewer"
  4. Restart Platform Unexpectedly the duplicated webviews stay empty
  5. Debug with https://github.com/paranext/paranext/wiki/Troubleshooting-Guide#debug-a-releasepackaged-build

Expected behavior previosly opened projects would show up on restart - also when opened twice in Platform

Sebastian-ubs commented 3 months ago

Still happening in 37c0b3d grafik

irahopkinson commented 3 months ago

Still happening in 37c0b3d

@Sebastian-ubs Have you tried recompiling? A simple way to do this is make an innocuous change to a file like src\main\main.ts, e.g. add and remove a space, then save it. PB will recompile and reload. I find that if I have moved from another branch that the first compile often has the old code in it and the recompile is needed. This fix is working for me.

tjcouch-sil commented 3 months ago

There is a separate issue that sometimes causes web views not to load anymore if they do not load properly even once between refreshes. Did you close and open these webviews and then restart? I can't reproduce this issue anymore even on the production build I downloaded (Platform.Bible 0.2.0-commit.37c0b3d.exe), so I will need help reproducing it if you still can.

Sebastian-ubs commented 3 months ago

It works fine in development (npm start) grafik

In production (Platform.Bible 0.2.0-commit.da9d954-latest.exe) it now only fails with tabs that had been opened from an older Platform version. grafik

This tab correctly opens up in the older 175a6fb but not in current da9d954 grafik

tjcouch-sil commented 3 months ago

Could you please attach a log file from starting up the new vs the old verisons that do and don't work with the old web view? Not all old tabs will work every time we make updates, especially breaking changes, so it might just be some old data that doesn't work with the new system. However, I did look at the code at the revision you mentioned, and it didn't look at first glance like it was much older.

Sebastian-ubs commented 3 months ago

With attaching remote debugger I got

renderer.js:2 Unexpected process type: undefined 7807 @ renderer.js:2 renderer.js:2 09:45:14.480 › Starting renderer renderer.js:2 09:45:14.989 › Got clientId 3 renderer.js:2 09:45:24.123 › No WebView provider found for WebView type platformScriptureEditor.react renderer.js:2 09:45:24.123 › web-view.component failed to retrieve web view content for {"id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}: Error: getWebView: Cannot find Web View Provider for webview type platformScriptureEditor.react

However on restarting Platform several times I got it to load one of the times, so seems to be some race condition / timing issue. grafik

Logfile from \AppData\Roaming\platform-bible\logs\ main.log

Sebastian-ubs commented 3 months ago

uff, after trying again, I can more precisely say, that it is not a special tab, but the most top left tab of my layout always (note that the webview ID has changed).

17:34:14.454 › No WebView provider found for WebView type platformScriptureEditor.react renderer.js:2 17:34:14.454 › web-view.component failed to retrieve web view content for {"id":"c318baec-c90f-4a0b-8f5d-b966c9111762","tabType":"webView","data":{"title":"NIV84 (Editable)","webViewType":"platformScriptureEditor.react","id":"c318baec-c90f-4a0b-8f5d-b966c9111762","state":{"isReadOnly":null},"projectId":"A6219DB975224F500877392222CF654A32477065","contentType":"react"}}: Error: getWebView: Cannot find Web View Provider for webview type platformScriptureEditor.react

grafik

Sebastian-ubs commented 3 months ago

Can again confirm the timing issue, as after the 5th or so trial I got it to show up one time. Attaching main.log

grafik

Sebastian-ubs commented 3 months ago

some new / clean logs with "debug": main.log

renderer.js:2 Unexpected process type: undefined 7807 @ renderer.js:2 renderer.js:2 17:51:32.080 › Starting renderer renderer.js:2 17:51:32.381 › Got clientId 3 renderer.js:2 17:51:41.555 › No WebView provider found for WebView type platformScriptureEditor.react renderer.js:2 17:51:41.556 › web-view.component failed to retrieve web view content for {"id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}: Error: getWebView: Cannot find Web View Provider for webview type platformScriptureEditor.react

From local storage: web-view-state:

[["f5a5fde2-476e-4e43-899b-3cdc5cf29966",{"isReadOnly":null}],["a5d2d9c8-bc06-4902-db4a-f1eaabddf4d5",{"isReadOnly":null}],["c605b7ab-1695-4763-e333-15b337bd4392",{"isReadOnly":null}],["c318baec-c90f-4a0b-8f5d-b966c9111762",{"isReadOnly":null}]]

dock-saved-layout

{"dockbox":{"id":"+21","size":250,"mode":"horizontal","children":[{"id":"+12","size":280,"mode":"vertical","children":[{"id":"+32","size":200,"mode":"horizontal","children":[{"id":"+34","size":200,"tabs":[{"id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}],"group":"card platform-bible","activeId":"d280c9de-6dcb-4879-89a1-7c4e2548fa4c"},{"id":"+16","size":200,"tabs":[{"id":"c605b7ab-1695-4763-e333-15b337bd4392","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"c605b7ab-1695-4763-e333-15b337bd4392","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}],"group":"card platform-bible","activeId":"c605b7ab-1695-4763-e333-15b337bd4392"}]},{"id":"+19","size":200,"mode":"horizontal","children":[{"id":"+7","size":200,"tabs":[{"id":"About","tabType":"about"}],"group":"card platform-bible","activeId":"About"},{"id":"+20","size":200,"tabs":[{"id":"a5d2d9c8-bc06-4902-db4a-f1eaabddf4d5","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"a5d2d9c8-bc06-4902-db4a-f1eaabddf4d5","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}],"group":"card platform-bible","activeId":"a5d2d9c8-bc06-4902-db4a-f1eaabddf4d5"}]}]},{"id":"+35","size":120,"mode":"vertical","children":[{"id":"+22","size":200,"tabs":[{"id":"f5a5fde2-476e-4e43-899b-3cdc5cf29966","tabType":"webView","data":{"title":"ESVUS16 (Editable)","webViewType":"platformScriptureEditor.react","id":"f5a5fde2-476e-4e43-899b-3cdc5cf29966","state":{"isReadOnly":null},"projectId":"F421FE261DA7624F0405A602838BBED467F5FDB2","contentType":"react"}}],"group":"card platform-bible","activeId":"f5a5fde2-476e-4e43-899b-3cdc5cf29966"},{"id":"+36","size":200,"tabs":[{"id":"c318baec-c90f-4a0b-8f5d-b966c9111762","tabType":"webView","data":{"title":"NIV84 (Editable)","webViewType":"platformScriptureEditor.react","id":"c318baec-c90f-4a0b-8f5d-b966c9111762","state":{"isReadOnly":null},"projectId":"A6219DB975224F500877392222CF654A32477065","contentType":"react"}}],"group":"card platform-bible","activeId":"c318baec-c90f-4a0b-8f5d-b966c9111762"}]}]},"floatbox":{"id":"+8","size":0,"mode":"float","children":[]},"windowbox":{"id":"+9","size":0,"mode":"window","children":[]},"maxbox":{"id":"+10","size":1,"mode":"maximize","children":[]}}

Sebastian-ubs commented 3 months ago

looks like the first webview of every extension fails to load

renderer.js:2 Unexpected process type: undefined 7807 @ renderer.js:2 renderer.js:2 18:23:57.196 › Starting renderer renderer.js:2 18:23:57.734 › Got clientId 3 renderer.js:2 18:24:06.930 › No WebView provider found for WebView type paratextBibleTextCollection.react renderer.js:2 18:24:06.930 › web-view.component failed to retrieve web view content for {"id":"192bc760-52ae-48ea-bb62-975b0868f23e","tabType":"webView","data":{"title":"Text Collection","tooltip":null,"webViewType":"paratextBibleTextCollection.react","id":"192bc760-52ae-48ea-bb62-975b0868f23e","iconUrl":"papi-extension://paratext-bible-text-collection/assets/Group24.svg","state":{"projectIds":[]},"projectId":"","contentType":"react"}}: Error: getWebView: Cannot find Web View Provider for webview type paratextBibleTextCollection.react (anonymous) @ renderer.js:2 renderer.js:2 18:24:06.940 › No WebView provider found for WebView type platformScriptureEditor.react renderer.js:2 18:24:06.940 › web-view.component failed to retrieve web view content for {"id":"56199c2c-943b-44b2-a5f3-1d6d07d22a08","tabType":"webView","data":{"title":"PCM (Editable)","webViewType":"platformScriptureEditor.react","id":"56199c2c-943b-44b2-a5f3-1d6d07d22a08","state":{"isReadOnly":null},"projectId":"B459B0BD26B6FD5A55E2FDE5390E08B84DD1A2AE","contentType":"react"}}: Error: getWebView: Cannot find Web View Provider for webview type platformScriptureEditor.react (anonymous) @ renderer.js:2 about:srcdoc:1 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing. about:srcdoc:1 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.

new debug logs: main.log

grafik

tjcouch-sil commented 2 months ago

Closing because it seems there are two slightly different issues now. The last handful of comments are related to the new issue #991

roopa0222 commented 2 months ago

Verified the issue with the repo steps, unable to reproduce the error. I have tried couple of times. It is working as expected. P.B is able to open all the web-views that were previously opened successfully.

Tested with https://github.com/paranext/paranext-core/commit/ad6e5b83ed8035c971735db765b85d419cc68e9e

Screenshot 2024-07-11 111130