giuspen / cherrytree

cherrytree
https://www.giuspen.net/cherrytree/
Other
3.4k stars 461 forks source link

Program crash when attempting to print #2066

Closed Groberen closed 1 year ago

Groberen commented 2 years ago

Version, Operative system Versjon Windows 10 Pro Versjon 21H1 Installert den ‎23.‎02.‎2021 Operativsystembygg 19043.1766 Opplevelse Windows Feature Experience Pack 120.2212.4180.0

Particular printer model in use RICOH MP C3504 PCL 6 Network printer.

Cherrytree version Version 0.99.47

Limitations Originally I plan to download an older version of CT (the compressed one because I want to put it in another directory so don't have to install over the current version) and also I didn't figured how to get hand in an older version at portableapps.com (because that site is designed in such a way that even if I find a page describing an older version of CT, the link to the download page will always only offer the very latest version - all pages at portableapps.com that describe older versions of CT seems to forward the user to the same download page).

So because of that I haven't being able to try to print using an older version of CT.

Describe the bug Some second after attempting to print the contents of a node, an error message pops up - after clicking on it, Cherrytree terminate and any work not saved will be lost.

Error message says (with English translation - as best as I can, but the exact wording in the English version of Windows may be different) [Window Title] cherrytree.exe

[Main Instruction] cherrytree.exe har sluttet å virke

[Content] Et problem førte til at programmet sluttet å fungere som det skal. Programmet vil bli lukket, og du vil få beskjed hvis en løsning er tilgjengelig. <a problem caused the program to stop properly working. The program will be closed and you'll get a message if a solution is available>

[Lukk program]

To Reproduce If applicable, attach a non-personal document where the issue can be reproduced systematically. Steps to reproduce the behavior:

  1. Open CT and a somewhat large database file.
  2. Find an appropriate node, and Print.
  3. Select to print only current node and also check the "print node name" also.
  4. In the printer dialog box, just click on the Print button - no particular setting necessary.
  5. Wait some seconds. For me this may take between 2-10 seconds (I never actually clocked this) without any visible changes on screen.
  6. Crash - the error message as shown above appear. Click Close
  7. Cherrytree terminates with no further messages.

Print to PDF or to Microsoft XPS printer - what happens On that particular computer, the Bullzip PDF printer is installed (the last version before the software turn useless without paying).

I made 3 attempt to select Bullzip PDF printer to print. In all 3 attempts, the following happens:

I made 2 attempts to use the Windows xps printer, and this happens:

Temporary workaround Use another word processor - I choosed Libre Office Writer. Select any text in the node, then copy and paste, then use the word processor to print. I'll have a look at the xps option when I got time, but since I have to use another software to print - I choose a word processor because I can then manage to control the page shifts. But - not a good solution.

giuspen commented 2 years ago

It is likely to be one particular node that causes the crash. I'm about to release a new version 0.99.48 where I have done a lot of work on multiple issues with the export to pdf on windows, so I hope the problem is already solved. If not please try to duplicate your database (copy/paste) then in the copy try to find which one is the node that causes the trouble and please share with me privetely

Groberen commented 2 years ago

I just tested this theory of bad database.

What I did:

Result: Still crashes the very same way as before.

I also repeated the test with one minor change - I unchecked the «include node name» option before printing, but with the same resulting crash.

Seems to me that the database is not the cause of this issue.

Groberen commented 2 years ago

Today I did more tests bacause of this issue.

First - I unpacked and replaced CT with version 0.99.48. Now, there is a difference - when attempting to print, there is no visible response for about 5-8 seconds, and then the Cherrytree process just terminates hard. Unlike previous version, no error message pops up.

Second - I tested if the settings could be the culprit After this test, I decided to delete (rename/backup) the "C:\Users\\AppData\Local\cherrytree\config.cfg" file. Just after clearing all previous settings, I opened Cherrytree, opened the database file and also the same node I wans't able to print out before. But this time, Cherrytree was actually sending to the printer and the printer made the paper without any issues. Sadly, this was an one time fluke.

The boring details I tried to figure what setting caused Cherrytree to crash at printing So at this point I made sure I had two version of config.cfg. The config.cfg itself, reverted from previous backup (i.e as it was before I started to use newest version of CT), and then I had config-1.cfg that was the default, just-made-from-first-start and also after opened the database and the particular node that I printed. No changes exept those.

At this point I felt certain that it had to be something about the config that caused CT to crash on print. The method I used to try to pin-point the exact setting that caused CT to crash was to use the program Winmerge in order to copy/replace/delete lines that are different. For each different line (or group of lines), I started CT, navigated to a specific node and then print. If CT crash on print, I move/copy/remove the next difference from config-1.cfg to config.cfg This means that between each test, the content of config.cfg gradually get more equal to config-1.cfg

And so I proceeded, but eventually - config.cfg was finally exactly to config-1.cfg - But somehow every attempt to print ended in CT crashing the same way, even when the files was becoming exactly identical by content.

That is why the one attempt that I was actually successfully able to print, was a rare fluke.

About that "fluke" - there was no difference in the number of apps or services open at the same time.

I also had this theory that I might be able to print - if and only if CT was starting up while no config.cfg was present. So I did the exact test once again, I deleted the config.cfg, open CT, then opened the database file, found the node and then printed. Result: CT dead crashed after approx. 5 seconds, just like all other attempts. And this was not expected, and from my point of view it seems this bug is not consistent.

Other important information in question - could it be a node/formatting error ?

So I have a somewhat large database consisting of text only, counts between 4-5 MB of size. I've tried to print several different nodes with different characteristics, every attempt ends up with CT crash hard.

I also have a couple of other databases, trying to print from one of them cause CT to crash hard.

giuspen commented 2 years ago

Would it be ok for you to send me privately your database (or exported node that causes the crash) so I can try and reproduce?

Groberen commented 2 years ago

Well - I can strip it completely down first. How do I proceed to send ?

giuspen commented 2 years ago

You can find my email in cherrytree help--about dialog

iNoSec2 commented 2 years ago

in the .48 version it is all broken on linux, i never ever be able to export to pdf but in the 2-3 latest released i cant even export to html anymore since it stop the export in random nodes (never the same). I post here since i opened an issue but no answer sadly, i'll be back to .44 where "export to html" worked

Groberen commented 2 years ago

I just sent a mail with a stripped-down version of database attached.

iNoSec2 commented 2 years ago

in the .48 version it is all broken on linux, i never ever be able to export to pdf but in the 2-3 latest released i cant even export to html anymore since it stop the export in random nodes (never the same). I post here since i opened an issue but no answer sadly, i'll be back to .44 where "export to html" worked

Confirm .44 export to HTML work perfectly on the same db when .47 and .48 didnt...

giuspen commented 2 years ago

Thanks @Groberen your dB is just an empty node and it is not crashing for me when I export it to pdf on Win10 with version 0.99.48. Is this empty single node also crashing for you? @iNoSec2 I can help if I can reproduce, please send me data privately

Groberen commented 2 years ago

I've just made an attempt to print from the same empty node (same file I sent you), it crashes on me just like before. Takes about 10-20 seconds when the program hangs, and then the error message pops up and application shut down hard.

[Window Title]

cherrytree.exe

[Main Instruction] cherrytree.exe har sluttet å virke

[Content] Et problem førte til at programmet sluttet å fungere som det skal. Programmet vil bli lukket, og du vil få beskjed hvis en løsning er tilgjengelig.

[Lukk program]

giuspen commented 2 years ago

@Groberen do you have more than a PC with windows where you can test this? Can you try to disable the antivirus and see if it changes? Also you may enable the debug log in the preferences dialog, then restart cherrytree and try and reproduce the crash and then paste the log here.

Groberen commented 2 years ago

No, sorry to say I have only acess to one speciment (that is connected on that particular network and also have access to that particular printer).

I DO have access to a W10 and a W11 laptops, but those aren't connected to same network and thus not able to test on a real printer.

But - enable debug Log I can do.

giuspen commented 2 years ago

@Groberen if you just export as PDF, does it also crash? This issue is also reported in https://github.com/giuspen/cherrytree/issues/2072 unfortunately it's not crashing for me :(

Groberen commented 2 years ago

Today I exported the empty node to pdf, no issue. Works for me. The pdf file are afaik. without any issues.

Groberen commented 2 years ago

Here is the contents of debug log.

[2022-07-25 12:00:32.949] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL.
[2022-07-25 12:00:33.033] [   ] [debug] set TEXMFROOT=T:/programmer/CherrytreePortable/mingw64/share OK
[2022-07-25 12:00:33.060] [   ] [debug] C:\Users\<username>\AppData\Local\cherrytree\config.cfg parsed
[2022-07-25 12:00:33.784] [   ] [debug] Node name: Prosjektlogger
[2022-07-25 12:02:27.742] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL.
[2022-07-25 12:02:28.021] [   ] [debug] set TEXMFROOT=T:/programmer/CherrytreePortable/mingw64/share OK
[2022-07-25 12:02:28.065] [   ] [debug] C:\Users\<username>\AppData\Local\cherrytree\config.cfg parsed
[2022-07-25 12:02:28.777] [   ] [debug] Node name: Prosjektlogger
[2022-07-25 12:02:29.982] [   ] [debug] shift images in MenuBar/context menu
[2022-07-25 12:02:32.631] [   ] [debug] Node name: 2022.07.05 Jordfeil - uselektivt
[2022-07-25 12:02:41.568] [   ] [debug] 98 -> charset: ASCII
[2022-07-25 12:02:41.595] [   ] [debug] 103 -> charset: ASCII

This debug log was from two sessions, in both cases printing was attempted and in both cases it crashed. First attempt on the empty​ node from the database file I sent earlier. Second attempt on the database in daily use.

Another bug - unrelated Note - I included the 7z file (in mail) containing the folder of the debug file because it turns out there is a charset bug. When i specify an existing folder (to save debug file) and that folder contains norwegian characters (possible not limited to only norwegian characters) - there is created a new folder with a name not consistent to the name I choosed (even if I copied the full folder name to and pasted it correctly).

iNoSec2 commented 2 years ago

Thanks @Groberen your dB is just an empty node and it is not crashing for me when I export it to pdf on Win10 with version 0.99.48. Is this empty single node also crashing for you? @iNoSec2 I can help if I can reproduce, please send me data privately

Actually in holiday, i'll send you the whole db next week. It is an heavy one, i think it is 1gb or more iirc (2-3 years of notes)

Ludovic-17 commented 2 years ago

hello, Just to say that I see the crash in printing on version 0.99.48 while everything is fine with version 0.99.46. I use Windows 10. Upon validation of printing after choosing the printer (tested towards Epson printer or printing Windows PDF), the program closes after a few seconds and no error message. If the PDF printing had been chosen, the PDF file exists but is 0 byte. Sorry for the absence of technical data but I am not a developer, just a user (and who does not speak English, thank you Google Translate).

I noted something in the Windows 10 event observer: The name of the faulty module is generally DWrite.dll version: 10.0.19041.1566 But also found an error on libstdc ++-6.dll, version: 0.0.0.0 and one concerning Libgtkmm-3.0-1.Dll, version: 3.24.6.1 These modules can be found in: C: \Program Files\Cherrytree \Mingw64\bin\

giuspen commented 2 years ago

@Ludovic-17 is it crashing when you print a particular node or even if you print an empty node?

Ludovic-17 commented 2 years ago

It happened whatever the base used and the chosen node. I even tried with a node containing only one word. I did not try with an empty node.

giuspen commented 2 years ago

Would you be able to try and build from the latest source code following the guide on https://github.com/giuspen/cherrytree#building-cherrytree-on-windows and report if that crashes too?

Ludovic-17 commented 2 years ago

Sorry, I'm a simple user. I went to see the link as well as https://www.msys2.org/ and it doesn't have my field at all. I am surprised that you cannot trigger this issue. Perhaps the solution is in what differs between the two versions (46 and 48). I will continue to use the 0.99.46 version.

giuspen commented 2 years ago

Unfortunately msys2 while very powerful is also pretty unstable. The libraries are continuously updated and those libraries are mostly tested on Linux while the problems on Windows come out after the updated library have been deployed. This is to say that every new cherrytree release have a lot of library updates on Windows and what I believe is that this is the real difference after 0.99.46. Since I'm going to release a new version 0.99.49 in about a week please report if the issue is still there.

iNoSec2 commented 2 years ago

I always been on linux and i wasnt ever able to print to pdf file or even export to pdf. The export to html is totally buggy since .47, it stop exporting at random nodes when it want to export something. It isnt a node problem or whatever since it is my study notes and it worked before so it is a change in the code. Cherrytree necome more and more unstable since .41

giuspen commented 2 years ago

@iNoSec2 the export to HTML crash should be fixed in the next release coming in a week, as for the export to pdf crash I cannot help if you don't give me some data to reproduce the crash. Another option is that you are able to build and run cherrytree from the source code following guidance of your distribution. If you can do so, I will instruct you on how to run cherrytree from the gdb debugger and print the backtrace after the crash. With the crash backtrace I can investigate further on your specific situation. Let me know.

giuspen commented 2 years ago

https://github.com/giuspen/cherrytree Debian/Linux Mint/Ubuntu Arch Linux/Manjaro Linux Gentoo Fedora Opensuse MacOs Windows

Ludovic-17 commented 2 years ago

Since I'm going to release a new version 0.99.49 in about a week please report if the issue is still there.

I just installed and try the new version 0.99.49 (after a restart of the PC) and that does not change anything. The problem is exactly the same on the same DLL (DWrite.dll).

I have just reinstalled the 0.99.46 version and the printing normally works.

giuspen commented 2 years ago

@Ludovic-17 so you identified the DLL that causes the crash, that helps. Have you tried downloading 0.99.49 portable archive from https://www.giuspen.net/cherrytree/#downl and replace/overwrite the faulty DLL is fixing the issue? (May be incompatible but it is worth a try)

Ludovic-17 commented 2 years ago

I noted in the Windows 10 event observer: The name of the faulty module is generally DWrite.dll version: 10.0.19041.1566 But also found an error on libstdc ++-6.dll, version: 0.0.0.0 and one concerning Libgtkmm-3.0-1.Dll, version: 3.24.6.1 These modules can be found in: C: \Program Files\Cherrytree\Mingw64\bin\

BUT DWRITE.DLL (Microsoft DirectX Typography Services) is actually found in C:\Windows\Syswow64 It is not at all in the Cherrytree's program file (why Windows indicates this location, mystery).

And so not in the portable archive either. Hope this can help you.

giuspen commented 2 years ago

No if it's not a DLL part of the portable archive then it is not the root cause. Potentially libgtkmm could be instead. I'm pretty sure it's one of the libraries that msys2 has upgraded after the 0.99.46 release that introduced the issue but I have an idea to verify this. As you still have the 0.99.46 bundle built at that time, I can build again 0.99.46 code using instead the current msys2 libraries and providing a link for you. So you will test 0.99.46 "bis" bundle and report if it crashes or not, are you happy to do this test for me?

Ludovic-17 commented 2 years ago

Why not. If this can help you diagnose the problem.

giuspen commented 2 years ago

Please try https://www.giuspen.net/software/cherrytree_0.99.46.0_20220919_win64_portable.7z and report if it crashes

Ludovic-17 commented 2 years ago

I tried this version and printing does not work. Same crash and same module concerned.

giuspen commented 2 years ago

Thanks @Ludovic-17 at least now I am 100% sure that it's an issue introduced in a library update in msys2.

If you would succeed in building/running cherrytree from the source code as described in https://github.com/giuspen/cherrytree#building-cherrytree-on-windows then I could guide you in copy and paste the crash log that I need to identify the library to blame so that I can then raise an issue there trying to have it fixed

Ludovic-17 commented 2 years ago

Sorry, I have already answered this subject. Each has their favorite field, their hobbie. For me, it is electronics applied to the High Frequency Domaine. I hate computer science and Windows 10 as soon as it starts to cough.

giuspen commented 2 years ago

No worries @Ludovic-17 thanks for your help so far

Ludovic-17 commented 1 year ago

Always the same crash problem during printing and with all versions greater than 0.99.46 on Windows 10. Obliged to stay in 0.99.46

giuspen commented 1 year ago

I would like to go to the bottom of this crash but without being able to reproduce it, it's impossible for me to do more progress. I know that it's caused by one msys2 library that cherrytree uses, so potentially every new msys2 upgrade could fix it, but if the bug is rare it may also never be fixed. There must be something in particular in your system that is triggering it, a setting or an installed application, everything can be. It would help me if you could do the same test on another PC and see if it happens there or not. If it doesn't happen there ideally you would try and understand what are the differences to help me set up a system that causes the issue.

Ludovic-17 commented 1 year ago

Fortunately, I went back there: my answer by email was copied here and made my complete contact details appear!? I just deleted the message in question. Nice github!

I just changed my pc. New Windows 10 Pro configuration, new installation of Cherrytree (latest portable version) and ?? Same problem (printing, to PDF or printer) and this, even on version 46 which still worked on my old PC.

Here is the line that appears in the log with each attempt to printing: 2023-01-26 21:20:16.873] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL.

This is another PC, a brand new installation of a Windows different from the one I had, there is nothing in common and Cherrytree does not work better, it's worse. So ?

giuspen commented 1 year ago

It may be related with your operative system language/locale... can you tell me what language is your OS? Please confirm that printing a node with all ascii characters (e.g. node name "ciao", content "ciao") still crashes. If you do File--Export--Export to PDF or if instead File--Print and then you print to file image do you see any difference?

Ludovic-17 commented 1 year ago

Language = French

Test carried out: A new database called test.ctb A single node called "test", Containing the following text: test

Result : PDF export button => Products a readable pdf. Printing to PDF => Program crash and the PDF file produces but 0 ko and reading error. Printing to the network printer => crash

In the log : [2023-01-27 09:00:23.953] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL. [2023-01-27 09:00:24.168] [ ] [debug] set TEXMFROOT=C:/CherryTree_portable/mingw64/share OK [2023-01-27 09:00:24.176] [ ] [debug] C:\CherryTree_portable\config.cfg parsed [2023-01-27 09:00:24.519] [ ] [debug] autosave is started [2023-01-27 09:00:26.060] [ ] [debug] Node name: test [2023-01-27 09:00:26.174] [ ] [debug] fs::download_file: start downloading https://raw.githubusercontent.com/giuspen/cherrytree/master/debian/changelog [2023-01-27 09:03:59.434] [gtk] [critical] Class::register_derived_type(): base_query.type_name is NULL. [2023-01-27 09:03:59.605] [ ] [debug] set TEXMFROOT=C:/CherryTree_portable/mingw64/share OK [2023-01-27 09:03:59.606] [ ] [debug] C:\CherryTree_portable\config.cfg parsed [2023-01-27 09:03:59.722] [ ] [debug] autosave is started [2023-01-27 09:04:00.299] [ ] [debug] Node name: test [2023-01-27 09:04:00.355] [ ] [debug] fs::download_file: start downloading https://raw.githubusercontent.com/giuspen/cherrytree/master/debian/changelog

Windows 10 event observer: First there is an application error (code 1000) which causes a "print service" error (code 372)

print service error : Print to pdf => Code d’erreur Win32 renvoyé par le processeur d’impression : 2152796161 Print to printer => Code d’erreur Win32 renvoyé par le processeur d’impression : 259

application error :

For Print to pdf : Nom de l’application défaillante cherrytree.exe, version : 0.99.53.0, horodatage : 0x6396384c Nom du module défaillant : DWrite.dll, version : 10.0.19041.1566, horodatage : 0x29a9e8ad Code d’exception : 0xc0000005 Décalage d’erreur : 0x0000000000025714 ID du processus défaillant : 0x848 Heure de début de l’application défaillante : 0x01d932256887e7c3 Chemin d’accès de l’application défaillante : C:\CherryTree_portable\mingw64\bin\cherrytree.exe Chemin d’accès du module défaillant: C:\Windows\SYSTEM32\DWrite.dll ID de rapport : 68bcf96a-a368-4976-aa83-40c27728bb8e Nom complet du package défaillant : ID de l’application relative au package défaillant :

For Print to printer : Nom de l’application défaillante cherrytree.exe, version : 0.99.53.0, horodatage : 0x6396384c Nom du module défaillant : DWrite.dll, version : 10.0.19041.1566, horodatage : 0x29a9e8ad Code d’exception : 0xc0000005 Décalage d’erreur : 0x0000000000025714 ID du processus défaillant : 0x33ac Heure de début de l’application défaillante : 0x01d93225e9517c57 Chemin d’accès de l’application défaillante : C:\CherryTree_portable\mingw64\bin\cherrytree.exe Chemin d’accès du module défaillant: C:\Windows\SYSTEM32\DWrite.dll ID de rapport : 54b429fc-8dc1-413d-8ba8-49add713c25a Nom complet du package défaillant : ID de l’application relative au package défaillant :

This is all the information I can give you.

giuspen commented 1 year ago

I finally understood and in fact I can reproduce the crash now. I don't know if I will be able to fix it in 0.99.54 but you have an easy workaround, you can create a pdf and then print from the PDF right? Anyway I'll try and find a solution soon, from my first analysis it looks like the crash is caused from the library https://packages.msys2.org/package/mingw-w64-x86_64-cairo I'll try to go back in time first to see when it started to cause the crash

Ludovic-17 commented 1 year ago

Yes, absolutely, I can go through the creation of a PDF for printing.

However, I hope that you will be able to repair this. It seems that we are on the right track anyway.

Finally, it seems that the defect appeared just after version 0.99.46 (at least it was the case for my old PC).

giuspen commented 1 year ago

This will be fixed in upcoming 0.99.54

Ludovic-17 commented 1 year ago

Fine result with 0.99.54, thank you ;)