![]() |
#1 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Sigil running multiple instances
I'm not sure if this is an issue with Sigil or with my environment. At times, I will run 2 copies of Sigil (one on each monitor). After I compiled the latest GitHub code, the first instance of Sigil runs happily. When I open the second instance, I get the wait cursor (endless spinning circle) and end up having to force kill the second instance. I reverted back to 2.4.2 beta 4 (the one that reports itself as 2.5.0 compiled on 2025-Mar-05) since I still had the installer and no problems running 2 instances.
Is anyone else seeing this issue on Windows? Misery would love some company. |
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Sorry, can not help here as the paradigm on MacOS is to allow multiple MainWindows from the same instance of Sigil.
Do your two displays use a single graphics card/driver instance or do you have multiple graphics cards installed? If sharing the one graphics card and mapping the two displays to different areas of the virtual display (side by side displays or top and bottom displays) it should work. But In all cases the two instances will share Sigil settings files, so perhaps one is trying to open up on top of or behind the second instance? Perhaps it is a problem with Qt WebEngine? Have you tried hiding Preview and then launching the second instance? Any other error messages get printed when you launch one from the command line? I will try this on Linux (two instances of Sigil running) but I only have a single display. Last edited by KevinH; 04-25-2025 at 02:32 PM. |
![]() |
![]() |
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,330
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I'll try it on Windows with the latest GitHub sometime this weekend. I also only have one display though.
|
![]() |
![]() |
![]() |
#4 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Just checked. I removed one display and the issue occurs when I try opening a second Sigil instance (right click on the Sigil icon in the taskbar and then click on Sigil) on the same display.
One oddment is that the 2nd instance shows as using 7-10% of CPU continuously while the first instance shows 0%. Last edited by DNSB; 04-25-2025 at 06:05 PM. Reason: added image of 2 Sigil instances in Task Manager |
![]() |
![]() |
![]() |
#5 | ||||
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Quote:
Quote:
Edit: disabled everything except the code window and the same result. Quote:
Just checked and removed the second display. The issue still happens when I open a second instance of Sigil. Last edited by DNSB; 04-25-2025 at 06:23 PM. |
||||
![]() |
![]() |
![]() |
#6 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
In Linux I happily opened 5 instances of Sigil at the same time with no issues. Using multiple MainWindows works on MacOS as well.
So whatever this is it is specific to Windows. |
![]() |
![]() |
![]() |
#7 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I'm rather hoping that @DiapDealer when he tests on Windows this weekend comes up with no issues so it's not an issue with the Sigil codebase.
|
![]() |
![]() |
![]() |
#8 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
I was reading on Windows 11 and saw that it supports multiple virtual desktops. Could Sigil have opened in a second virtual Desktop?
|
![]() |
![]() |
![]() |
#9 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I tried opening a virtual desktop and got the same result. Opened Sigil in desktop 1, switched to desktop 2, opened a second Sigil instance and Sigil hung with the wait cursor. Oddly the minimize and full screen/window button still work but the close button does not.
|
![]() |
![]() |
![]() |
#10 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
That is a weird one. Let's hope DiapDealer or BeckyEbook has some ideas?
|
![]() |
![]() |
![]() |
#11 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
There was one recent change that could cause an infinite loop but should not.
This is the one I am worrying about: https://github.com/Sigil-Ebook/Sigil...afbe68f6c1d6b2 So could you try the following change to see if it helps in any way: In Sigil/src/ViewEditors/ViewPreview.cpp Code:
void ViewPreview::CustomSetDocument(const QString &path, const QString &html) { if (html.isEmpty()) { return; } m_CustomSetDocumentInProgress = true; if (!url().isEmpty()) { // Storing the Caret Location here causes problems as it happens to interfere with later loading // StoreCurrentCaretLocation(); // To keep memory footprint small, clear any caches when a new page loads // But in Qt 6.7.0 and later cache clearing became asynchronous requiring a callback // *before* trying to load anything after a cache clear, otherwise loading // remote resources fails // Note: toLocalFile() fails with any custom scheme (ie. our sigil: scheme) // So convert url to file: scheme to extract the local file QUrl localurl(url()); localurl.setScheme("file"); localurl.setHost(""); if (localurl.toLocalFile() != path) { DBG qDebug() << "clearing Preview's httpcache"; #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) m_CacheCleared = false; #endif page()->profile()->clearHttpCache(); while(!m_CacheCleared) { qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 50); } } } In other words make it look like the following: Code:
void ViewPreview::CustomSetDocument(const QString &path, const QString &html) { if (html.isEmpty()) { return; } m_CustomSetDocumentInProgress = true; if (!url().isEmpty()) { // Storing the Caret Location here causes problems as it happens to interfere with later loading // StoreCurrentCaretLocation(); // To keep memory footprint small, clear any caches when a new page loads // But in Qt 6.7.0 and later cache clearing became asynchronous requiring a callback // *before* trying to load anything after a cache clear, otherwise loading // remote resources fails // Note: toLocalFile() fails with any custom scheme (ie. our sigil: scheme) // So convert url to file: scheme to extract the local file QUrl localurl(url()); localurl.setScheme("file"); localurl.setHost(""); if (localurl.toLocalFile() != path) { DBG qDebug() << "clearing Preview's httpcache"; #if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) // m_CacheCleared = false; #endif // page()->profile()->clearHttpCache(); while(!m_CacheCleared) { qApp->processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers, 50); } } } Perhaps there is some lock being held on the cache so that the second instance can never clear it properly. If that is the case I will have to rethink/redesign the clearing of the cache code so that two different Sigil instances use separate caches. Perhaps by using uuid generation to make unique cache names. If you get a free moment, please give that a try and let me know if that is the culprit. Last edited by KevinH; 04-25-2025 at 09:26 PM. |
![]() |
![]() |
![]() |
#12 |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,368
Karma: 167205629
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
I tried that modification and it worked! I launched 4 Sigil instances and they were happy campers.
|
![]() |
![]() |
![]() |
#13 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,330
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Wow! Good catch. That's not something I would have suspected.
|
![]() |
![]() |
![]() |
#14 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
So on Windows the cache is being locked and therefore can not be cleared by a second or third instance of Sigil.
I ran some experiments and the web profile name "Preview" in our case (see Misc/ WebProfileMgr.cpp) is not being used so adding a uuid to it will not help. I will have to create unique "local-storage" locations for each instance of Sigil inside Prefs somehow to allow the cache to be properly cleared. Thanks for reporting that bug and testing things to confirm its source. Last edited by KevinH; 04-26-2025 at 08:40 AM. |
![]() |
![]() |
![]() |
#15 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,431
Karma: 5702578
Join Date: Nov 2009
Device: many
|
Okay from looking around, Qt seems to put its cache files everyplace even though we provide it with a local storage path.
This is so strange ... It seems that some caching is done in our Sigil Prefs inside the designated local-storage folder. It seems a QtWebEngine folder is also created there but it is basically empty always. Then I found some recent cache files in ~/Libary/Caches/sigil-ebook/sigil/ locations which is Qt's StandardPaths::CacheLocation Here is what Qt's StandardPaths::CacheLocation that defaults to on all three platforms: MacOS: ~/Library/Caches/<APPNAME> (APPNAME for me was sigil-ebook/sigil/) Windows: "C:/Users/<USER>AppData/Local/<APPNAME>/cache" Linux: ~/.cache/<APPNAME> If I look inside that I do find a cache called "Preview" as expected and it does have some data. But there is a bunch of stuff in our Sigil Prefs folder in the assigned "local-storage" folder that is updated when working in Sigil as well. I have no idea which of these locations on Windows, that the second (or third or ...) instance of Sigil is being locked out of. I have no idea why QtWebEngine is spreading its working files all over the place. So I am not sure which name or path needs to be extended by a uuid. I tried wiping out all of those cache locations and local-storage locations and restarting Sigil and they are all being recreated and used. What are people seeing under Linux and Windows? Last edited by KevinH; 04-26-2025 at 10:36 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Multiple content-server instances possible ? | Tuxracer | Server | 15 | 05-28-2022 02:09 PM |
Running 2 instances in order to merge/combine two very different libraries? | manawydan | Library Management | 1 | 12-28-2020 06:41 PM |
Way to open multiple instances of calibre? | charlweed | Server | 1 | 12-28-2018 09:24 PM |
Two instances of calibre running | BetterRed | Calibre | 2 | 06-19-2017 04:18 AM |
Two or multiple instances of Calibre on one computer | clockmaker | Library Management | 2 | 06-30-2012 01:55 PM |