paranext / paranext-core

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

Running multiple instances of Platform throws error #929

Open Sebastian-ubs opened 3 months ago

Sebastian-ubs commented 3 months ago

Describe the bug When opening the second instance the following error is thrown

Error: listen EADDRINUSE: address already in use :::8876 [Window Title] Error [Main Instruction] A JavaScript error occurred in the main process [Content] Uncaught Exception: Error: listen EADDRINUSE: address already in use :::8876 at Server.setupListenHandle [as _listen2] (node:net:1751:16) at listenInCluster (node:net:1799:12) at Server.listen (node:net:1887:7) at new e.exports (C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\node_modules\ws\lib\websocket-server.js:102:20) at d.connect (C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\src\main\services\server-network-connector.service.ts:165:28) at le (C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\src\shared\services\connection.service.ts:245:53) at processTicksAndRejections (node:internal/process/task_queues:95:5) at mainWindow (C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\src\shared\services\network.service.ts:719:5) at Ir (C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\src\main\main.ts:67:7) at C:\Users\Sebi\AppData\Local\Temp\2hTkQv8AUCWnT8RHNRkUTrrQO1V\resources\app.asar\dist\main\webpack:\src\main\main.ts:368:15 [OK]

Clicking "ok" opens Platform like this, and now this 2nd window's menu action seem not to be working. But actually... when clicking "open scripture editor" or "open resource viewer" it opens up the dialog in the first window 😄

grafik

Even the scripture reference controls are connected between windows (which might actually be a desired behaviour) grafik

Closing and re-opening the first one restors it's layout, opens without errors and works normally. Meanwhile this breaks the connection with the 2nd window and so leaves the 2nd without interaction possibilities.

Even worse, when having a built version running and trying to run Platform from npm, it would throw the error and then get stuck.

To Reproduce tested with build 27318c8 see above

Expected behavior Can run multiple instances of Platform.Bible without errors

Sebastian-ubs commented 2 months ago

grafik

CraigNisbett commented 1 month ago

Do not allow a second instance to be opened. Switch to current instance instead.

Sebastian-ubs commented 1 month ago

I assume this comment talks about fixing the behavior of the current Platform, which will be later improved by

right?

lyonsil commented 1 month ago

yes