Main place for discussions about U++ cross platform development framework.
I get a bunch of warnings like below when compiling on MacOS 10.15: /Users/XXX/dvlp/cpp/code/upp/git/uppsrc/ide/RepoSync.cpp:283:6: note: use non-reference type 'Upp::KeyValueRef<Upp::String, int>' for(const auto& w : ~work) { ^~~~~~~~~~~~~~~ Basically, a reference is pointing to a temporary object. And I'm getting random crashes with TheIDE when launching it on Linux (I'm not using a binary compiled on MacOS ) I guess, these crashes and references to temporary objects are related. TIA
Re: Compilation warnings and random crashes
VectorMap<String, int> work; work is VectorMap ... MapKVRange<AMap, K, T> operator~() { return MapKVRange<AMap, K, T>(*this); } operator~() returns a newly created object. So, compiler is right: you are referencing temporary objects ...
It is allowed. Range in for loop can be temporary. Here is the disscussion (note that it discusses UB case, but U++ use is the first legal one): https://www.sandordargo.com/blog/2022/04/20/range-base-p2012 I am currently testing with MacOS 14.5 and getting no such warning. Crashes in Linux are probably caused by something else. Mirek
Hi, I think I can confirm Novo here. TheIDE crashes frequently on linux (gtk), on the main package selection screen if I close a project and try to open a new one. It appears to happen while TheIDE is trying to load the packages list. I am using the nightly builds. P.s.: One other point is, I don't get any crashes or warnings on debug builds. No matter how I tried, it just did not crash. (in release builds I get the invalid memory access error a lot.) Best regards, Oblivion
Oblivion wrote on Sun, 13 October 2024 12:50 Hi, I think I can confirm Novo here. TheIDE crashes frequently on linux (gtk), on the main package selection screen if I close a project and try to open a new one. You mean completely close theide, then start it again? Or choose File / Open main package? If the first one, does it depend on the interval between closing and starting again? In both cases, does it crash without user inputs or do you do something?
Oblivion wrote on Sun, 13 October 2024 12:50 P.s.: One other point is, I don't get any crashes or warnings on debug builds. No matter how I tried, it just did not crash. (in release builds I get the invalid memory access error a lot.) What about release build with full debug info, started from gdb?
Hello Mirek, It does not happen when I completely exit TheIdE. It only happens when I try to open another project. The package selection screen comes up and the app crashes (not always, but most of the time). TheIDE on release mode (FULL_DEBUG flag) points to below line: Thread 1 "theide" received signal SIGSEGV, Segmentation fault. Upp::Image::Image (this=0x7ffffffe71e0, img=...) at /home/user/upp/devel/uppsrc/Draw/Image.cpp:295 295 data->Retain(); I hope this helps. Best regards, Oblivion
Oblivion wrote on Thu, 17 October 2024 11:47 Hello Mirek, It does not happen when I completely exit TheIdE. It only happens when I try to open another project. The package selection screen comes up and the app crashes (not always, but most of the time). TheIDE on release mode (FULL_DEBUG flag) points to below line: Thread 1 "theide" received signal SIGSEGV, Segmentation fault. Upp::Image::Image (this=0x7ffffffe71e0, img=...) at /home/user/upp/devel/uppsrc/Draw/Image.cpp:295 295 data->Retain(); Excellent, that narrows it down probably to loading icons, but I bet there is a backtrace ("bt") ? Mirek
Oops, I forgot to attach that. #0 Upp::Image::Image (this=0x7ffffffe71e0, img=...) at /home/user/upp/devel/uppsrc/Draw/Image.cpp:295 #1 Upp::Iml::Get (this=<optimized out>, i=<optimized out>) at /home/user/upp/devel/uppsrc/Draw/Iml.cpp:154 #2 0x00005555556e76e9 in SelectPackageDlg::SyncList (this=this@entry=0x7ffffffe7750, find=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:677 #3 0x00005555556deead in SelectPackageDlg::Load (this=this@entry=0x7ffffffe7750, find=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:761 #4 0x00005555556e3ac4 in SelectPackageDlg::OnBase (this=0x7ffffffe7750) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:420 #5 0x0000555555996e1f in Upp::Function<void()>::operator() (this=0x7ffffffe8800) at /home/user/upp/devel/uppsrc/Core/Function.h:76 #6 Upp::ArrayCtrl::SetCursor0 (this=0x7ffffffe8290, i=8, dosel=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlLib/ArrayCtrl.cpp:1487 #7 0x00005555556e6a76 in SelectPackageDlg::SyncBase (this=this@entry=0x7ffffffe7750, initvars=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:837 #8 0x00005555556e630d in SelectPackageDlg::Run (this=this@entry=0x7ffffffe7750, nest=..., startwith=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:362 #9 0x00005555556ecd3b in SelectPackage (nest=..., title=title@entry=0x7ffff25d4bc8 "Select main package (TheIDE 17514)", startwith=0x7ffff273f748 "examples/SshTerminalSplitterExample", selectvars=<optimized out>, main=<optimized out>) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:864 #10 0x000055555572ae45 in Ide::OpenMainPackage (this=0x7ffffffe9e10) at /home/user/upp/devel/uppsrc/ide/ide.cpp:215 #11 0x000055555572b0a2 in Ide::NewMainPackage (this=0x7ffffffe71e0) at /home/user/upp/devel/uppsrc/ide/ide.cpp:234 #12 0x0000555555cd932e in Upp::Function<void()>::operator() (this=<optimized out>) at /home/user/upp/devel/uppsrc/Core/Function.h:76 #13 Upp::Ctrl::Action (this=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/Ctrl.cpp:414 #14 0x0000555555a26f0b in Upp::MenuItem::LeftUp (this=0x7ffff26cdd60) at /home/user/upp/devel/uppsrc/CtrlLib/MenuItem.cpp:382 #15 0x0000555555ce71b0 in Upp::Ctrl::MouseEvent (this=0x7ffffffe71e0, event=<optimized out>, p=..., zdelta=115, keyflags=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:190 #16 0x0000555555ce67bf in Upp::Ctrl::MouseEvent0 (this=this@entry=0x7ffff26cdd60, event=event@entry=145, p=..., zdelta=zdelta@entry=0, keyflags=keyflags@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:96 #17 0x0000555555ce6b46 in Upp::Ctrl::MouseEventH (this=this@entry=0x7ffff26cdd60, event=event@entry=145, p=..., zdelta=zdelta@entry=0, keyflags=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:116 #18 0x0000555555ce81de in Upp::Ctrl::MEvent0 (this=this@entry=0x7ffff26cdd60, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:364 #19 0x0000555555ce8837 in Upp::Ctrl::DispatchMouseEvent (this=<optimized out>, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #20 0x0000555555ce8810 in Upp::Ctrl::DispatchMouseEvent (this=<optimized out>, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #21 0x0000555555ce8810 in Upp::Ctrl::DispatchMouseEvent (this=this@entry=0x7ffff260ada0, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #22 0x0000555555ceaa88 in Upp::Ctrl::DispatchMouse (this=this@entry=0x7ffff260ada0, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:622 #23 0x0000555555cfddb6 in Upp::Ctrl::DispatchMouseIn (this=0x7ffff260ada0, act=145, zd=0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:444 #24 Upp::Ctrl::GtkMouseEvent (this=<optimized out>, action=<optimized out>, act=145, zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:454 #25 0x0000555555cfe04b in Upp::Ctrl::GtkButtonEvent (this=this@entry=0x7ffff260ada0, action=action@entry=144) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:478 #26 0x0000555555cfec24 in Upp::Ctrl::Proc (this=this@entry=0x7ffff260ada0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:581 #27 0x0000555555cffb84 in Upp::Ctrl::ProcessEvent0 (quit=quit@entry=0x0, fetch=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:766 #28 0x0000555555cffd81 in Upp::Ctrl::ProcessEvents0 (quit=quit@entry=0x0, fetch=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:793 #29 0x0000555555cf171e in Upp::Ctrl::ProcessEvents (quit=0x0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:810 #30 Upp::Ctrl::EventLoop (ctrl=ctrl@entry=0x7ffffffe9e10) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:844 #31 0x0000555555cf4ded in Upp::TopWindow::Run (this=0x7ffffffe9e10, appmodal=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/TopWindow.cpp:323 #32 0x00005555557bbdb6 in GuiMainFn_ () at /home/user/upp/devel/uppsrc/ide/main.cpp:435 #33 0x0000555555ae38ab in Upp::AppExecute__ (app=0x5555557bac20 <GuiMainFn_()>) at /home/user/upp/devel/uppsrc/Core/App.cpp:479 #34 0x00005555557bab45 in main (argc=1, argv=0x7fffffffe088, envptr=0x55555683fe00) at /home/user/upp/devel/uppsrc/ide/main.cpp:177 Best regards, Oblivion
Can I ask for a little experiment: ide/SelectPkg.cpp:671 for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; Image icon = IdeImg::Package(); /* Image icon = pkg.icon; if(IsNull(icon)) { if(pkg.main) icon = pkg.upphub ? IdeImg::HubMainPackage() : IdeImg::MainPackage(); else icon = pkg.upphub ? IdeImg::HubPackage() : IdeImg::Package(); } */ nest_list.Add(pkg.nest); clist.Add(pkg.package, DPI(icon, 16)); alist.Add(pkg.package, GetFileName(pkg.nest), pkg.description, icon); alist.SetDisplay(alist.GetCount() - 1, 0, pkg.main ? bpd : pd); } ide/SelectPkg.cpp:790 if(d.ispackage && 0) { String icon_path; if(IsUHDMode()) Does it crash with these? Mirek
Done. No crashes.Tried it ovew 30 times. Usually it should have crashed at my every 2nd or 3rd attempt. If you need any more test, let me know. Best regards, Oblivion
Oblivion wrote on Thu, 17 October 2024 13:10 Done. No crashes.Tried it ovew 30 times. Usually it should have crashed at my every 2nd or 3rd attempt. If you need any more test, let me know. Best regards, Oblivion Well, try to reactivate the first oneand leave the second one (... && 0) And then maybe reversed
The first one crashes. The second one doesn't. Best regards, Oblivion
What about (after reverting to master to remove both changes): ide/SelectPkg.cpp:787 if(d.ispackage) { String icon_path; if(IsUHDMode()) icon_path = AppendFileName(path, "icon32x32.png"); if(IsNull(icon_path) || !FileExists(icon_path)) icon_path = AppendFileName(path, "icon16x16.png"); tm = FileGetTime(icon_path); if(IsNull(tm)) // package icon does not exist d.icon = Null; else if(tm != d.itm || d.icon.GetSize().cx != DPI(16)) { // chached package icon outdated d.icon = StreamRaster::LoadFileAny(icon_path); d.itm = tm; } d.icon.Clear(); } (added d.icon.Clear to make it Null)
No, reverting to master and clearing the icon didn't help. Crashes returned. Best regards, Oblivion
What about this: DLOG("=================="); for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; Image icon = pkg.icon; RDUMP(IdeImg::HubMainPackage().GetSize()); RDUMP(IdeImg::MainPackage().GetSize()); RDUMP(IdeImg::HubPackage().GetSize()); RDUMP(IdeImg::Package().GetSize()); RDUMP(~IdeImg::HubMainPackage()); RDUMP(~IdeImg::MainPackage()); RDUMP(~IdeImg::HubPackage()); RDUMP(~IdeImg::Package()); if(IsNull(icon)) { if(pkg.main) icon = pkg.upphub ? IdeImg::HubMainPackage() : IdeImg::MainPackage(); else icon = pkg.upphub ? IdeImg::HubPackage() : IdeImg::Package(); } nest_list.Add(pkg.nest); clist.Add(pkg.package, DPI(icon, 16)); alist.Add(pkg.package, GetFileName(pkg.nest), pkg.description, icon); alist.SetDisplay(alist.GetCount() - 1, 0, pkg.main ? bpd : pd); } (log after crash...) Mirek
================== IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 ****************** PANIC: Invalid memory access!
This time I get another error LOG ================== IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7ffff25a8850 ~IdeImg::MainPackage() = 0x7ffff24edb50 ~IdeImg::HubPackage() = 0x7ffff2731750 ~IdeImg::Package() = 0x7ffff2579a50 Backtrace: -------------------------------- #0 Upp::String0::LSet (this=0x7ffffffe70e0, s=...) at /home/user/upp/devel/uppsrc/Core/StringMem.i:10 #1 0x0000555555c65b47 in Upp::String0::Set0 (this=0x7ffffffe70e0, s=...) at /home/user/upp/devel/uppsrc/Core/String.h:264 #2 Upp::String::String (this=0x7ffffffe70e0, s=...) at /home/user/upp/devel/uppsrc/Core/String.h:385 #3 Upp::Iml::GetId (this=0x5555566b3250 <IdeImg::Iml()::iml>, i=<optimized out>) at /home/user/upp/devel/uppsrc/Draw/Image.h:317 #4 Upp::Iml::Get (this=0x5555566b3250 <IdeImg::Iml()::iml>, i=<optimized out>) at /home/user/upp/devel/uppsrc/Draw/Iml.cpp:150 #5 0x00005555557a11ff in IdeImg::Get (i=327) at /home/user/upp/devel/uppsrc/Draw/iml_source.h:113 #6 0x000055555588db97 in SelectPackageDlg::SyncList (this=this@entry=0x7ffffffe7750, find=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:686 #7 0x000055555588556b in SelectPackageDlg::Load (this=this@entry=0x7ffffffe7750, find=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:769 #8 0x0000555555889ea4 in SelectPackageDlg::OnBase (this=0x7ffffffe7750) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:420 #9 0x000055555599743f in Upp::Function<void()>::operator() (this=0x7ffffffe8800) at /home/user/upp/devel/uppsrc/Core/Function.h:76 #10 Upp::ArrayCtrl::SetCursor0 (this=0x7ffffffe8290, i=8, dosel=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlLib/ArrayCtrl.cpp:1487 #11 0x000055555588c9c6 in SelectPackageDlg::SyncBase (this=this@entry=0x7ffffffe7750, initvars=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:846 #12 0x000055555588c2b7 in SelectPackageDlg::Run (this=this@entry=0x7ffffffe7750, nest=..., startwith=...) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:362 #13 0x0000555555891c3b in SelectPackage (nest=..., title=title@entry=0x7fff9a50a388 "Select main package (TheIDE 17522)", startwith=0x7ffffffea630 "GLDrawDemo", selectvars=<optimized out>, main=<optimized out>) at /home/user/upp/devel/uppsrc/ide/SelectPkg.cpp:873 #14 0x000055555571c835 in Ide::OpenMainPackage (this=0x7ffffffe9e10) at /home/user/upp/devel/uppsrc/ide/ide.cpp:215 #15 0x000055555571ca92 in Ide::NewMainPackage (this=0x7ffffffe70e0) at /home/user/upp/devel/uppsrc/ide/ide.cpp:234 #16 0x0000555555cd9d2e in Upp::Function<void()>::operator() (this=<optimized out>) at /home/user/upp/devel/uppsrc/Core/Function.h:76 #17 Upp::Ctrl::Action (this=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/Ctrl.cpp:414 #18 0x0000555555a2752b in Upp::MenuItem::LeftUp (this=0x7ffff26cdd60) at /home/user/upp/devel/uppsrc/CtrlLib/MenuItem.cpp:382 #19 0x0000555555ce7b00 in Upp::Ctrl::MouseEvent (this=0x7ffffffe70e0, event=<optimized out>, p=..., zdelta=0, keyflags=1447356480) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:190 #20 0x0000555555ce710f in Upp::Ctrl::MouseEvent0 (this=this@entry=0x7ffff26cdd60, event=event@entry=145, p=..., zdelta=zdelta@entry=0, keyflags=keyflags@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:96 #21 0x0000555555ce7496 in Upp::Ctrl::MouseEventH (this=this@entry=0x7ffff26cdd60, event=event@entry=145, p=..., zdelta=zdelta@entry=0, keyflags=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:116 #22 0x0000555555ce8b2e in Upp::Ctrl::MEvent0 (this=this@entry=0x7ffff26cdd60, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:364 #23 0x0000555555ce9187 in Upp::Ctrl::DispatchMouseEvent (this=<optimized out>, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #24 0x0000555555ce9160 in Upp::Ctrl::DispatchMouseEvent (this=<optimized out>, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #25 0x0000555555ce9160 in Upp::Ctrl::DispatchMouseEvent (this=this@entry=0x7ffff260aa80, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:648 #26 0x0000555555ceb3d8 in Upp::Ctrl::DispatchMouse (this=this@entry=0x7ffff260aa80, e=e@entry=145, p=..., zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/CtrlMouse.cpp:622 #27 0x0000555555cfea56 in Upp::Ctrl::DispatchMouseIn (this=0x7ffff260aa80, act=145, zd=0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:444 #28 Upp::Ctrl::GtkMouseEvent (this=<optimized out>, action=<optimized out>, act=145, zd=zd@entry=0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:454 #29 0x0000555555cfeceb in Upp::Ctrl::GtkButtonEvent (this=this@entry=0x7ffff260aa80, action=action@entry=144) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:478 #30 0x0000555555cff8c4 in Upp::Ctrl::Proc (this=this@entry=0x7ffff260aa80) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:581 #31 0x0000555555d00824 in Upp::Ctrl::ProcessEvent0 (quit=quit@entry=0x0, fetch=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:766 #32 0x0000555555d00a21 in Upp::Ctrl::ProcessEvents0 (quit=quit@entry=0x0, fetch=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:793 #33 0x0000555555cf206e in Upp::Ctrl::ProcessEvents (quit=0x0) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:810 #34 Upp::Ctrl::EventLoop (ctrl=ctrl@entry=0x7ffffffe9e10) at /home/user/upp/devel/uppsrc/CtrlCore/GtkEvent.cpp:844 #35 0x0000555555cf573d in Upp::TopWindow::Run (this=0x7ffffffe9e10, appmodal=<optimized out>) at /home/user/upp/devel/uppsrc/CtrlCore/TopWindow.cpp:323 #36 0x00005555557adda6 in GuiMainFn_ () at /home/user/upp/devel/uppsrc/ide/main.cpp:435 #37 0x0000555555ae3ecb in Upp::AppExecute__ (app=0x5555557acc10 <GuiMainFn_()>) at /home/user/upp/devel/uppsrc/Core/App.cpp:479 #38 0x00005555557acb35 in main (argc=1, argv=0x7fffffffe088, envptr=0x55555683fe00) at /home/user/upp/devel/uppsrc/ide/main.cpp:177
Oblivion wrote on Thu, 17 October 2024 14:40 ================== IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 IdeImg::HubMainPackage().GetSize() = (16, 16) IdeImg::MainPackage().GetSize() = (16, 16) IdeImg::HubPackage().GetSize() = (16, 16) IdeImg::Package().GetSize() = (16, 16) ~IdeImg::HubMainPackage() = 0x7e845c9a8850 ~IdeImg::MainPackage() = 0x7e845c8edb50 ~IdeImg::HubPackage() = 0x7e845cb31750 ~IdeImg::Package() = 0x7e845c979a50 ****************** PANIC: Invalid memory access! Weird... What about for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; Image icon = pkg.icon; #define DD(x) RDUMP(x.GetSize()); RLOGHEXDUMP(~x, min(32, int(x.GetLength() * sizeof(RGBA)))); DD(IdeImg::HubMainPackage()); DD(IdeImg::MainPackage()); DD(IdeImg::Package()); DD(IdeImg::HubPackage()); DD(icon); #undef DD if(IsNull(icon)) { As far I can see it is either - compiler bug - IdeImg is busted, but it is weird that it does not happen in the first iteration - pkg.icon is busted, although this is hardly explains final crash in Image copy contructor (that AFAIK is call to Retain the data from Iml) Another thing to try is for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; Image icon = Null; // <<<<<============= #define DD(x) RDUMP(x.GetSize()); RLOGHEXDUMP(~x, min(32, int(x.GetLength() * sizeof(RGBA)))); DD(IdeImg::HubMainPackage()); DD(IdeImg::MainPackage()); DD(IdeImg::Package()); DD(IdeImg::HubPackage()); DD(icon); #undef DD if(IsNull(icon)) { Uh and please send the whole log - want to compare with "good run" (first invocation of dialog)
Oblivion wrote on Thu, 17 October 2024 14:48 This time I get another error After a lot of thinking I believe that the only plausible explanation is that another thread calls Iml::Reset somehow. Can you crash it and then send backtrace of ALL threads?
Quote: After a lot of thinking I believe that the only plausible explanation is that another thread calls Iml::Reset somehow. Can you crash it and then send backtrace of ALL threads? Thank you for your efforts. Will do, but this weekend. I am away from my computer today. Best regards, Oblivion
Oblivion wrote on Fri, 18 October 2024 09:42 Quote: After a lot of thinking I believe that the only plausible explanation is that another thread calls Iml::Reset somehow. Can you crash it and then send backtrace of ALL threads? Thank you for your efforts. Will do, but this weekend. I am away from my computer today. Best regards, Oblivion Also, can you try with this attempt at fix (but it would explain it just partly, still would like to have bt of all threads after the crash without the fix): void Iml::Reset() { for(IImage& m : map) m.loaded = false; }
I have attached TheIDe's log and full backtrace. Quote: Also, can you try with this attempt at fix (but it would explain it just partly, still would like to have bt of all threads after the crash without the fix): void Iml::Reset() { for(IImage& m : map) m.loaded = false; } Tried but didn't fix it. One interesting thing I've noticed is that the crash seems to be triggered in certain assemblies. But to be sure, it needs more test... Best regards, Oblivion
(maybe those specific assemblies have custom icons to display in package list?) Anyway, from backtraces it looks like indexer/libclang is running full steam. Can you try with assist++ off? Also, can you please update logging to: https://www.ultimatepp.org/forums/index.php?t=msg&th=122 73&goto=61004&#msg_61004 and perhaps separately try setting Image icon = Null;
Quote: (maybe those specific assemblies have custom icons to display in package list?) No. Quote: Anyway, from backtraces it looks like indexer/libclang is running full steam. Can you try with assist++ off? I have attached the logs. However, I noticed that it crashes less frequently when the indexer/assist++ is off. Quote: and perhaps separately try setting Image icon = Null; Will try. Best regards, Oblivion
Oblivion wrote on Sat, 19 October 2024 13:24 Quote: (maybe those specific assemblies have custom icons to display in package list?) No. Quote: Anyway, from backtraces it looks like indexer/libclang is running full steam. Can you try with assist++ off? I have attached the logs. However, I noticed that it crashes less frequently when the indexer/assist++ is off. Quote: and perhaps separately try setting Image icon = Null; Will try. Best regards, Oblivion And the last obligatory question: It really is crashing only on opening new main package, right? And BTW, when you test, do you test like for(;;) { Ctrl+M, Esc } or like for(;;) { Ctrl+M, select package, Enter } ?
Quote: And the last obligatory question: It really is crashing only on opening new main package, right? Yes, while TheIDE is loading the main packages list. Quote: And BTW, when you test, do you test like for(;;) { Ctrl+M, Esc } or like for(;;) { Ctrl+M, select package, Enter } ? Doesn't make any difference, TheIDE crashes after it switches to the package selection dialog. However, I'm suspecting this is a compiler error now. (maybe O3 optimization level related?). I'll try other options (O2 and GCC), report back asap. Best regards, Oblivion
[quote title=Oblivion wrote on Sat, 19 October 2024 17:09]Quote: And the last obligatory question: It really is crashing only on opening new main package, right? However, I'm suspecting this is a compiler error now. (maybe O3 optimization level related?). I'll try other options (O2 and GCC), report back asap. Well, clang got picky over unaligned access undefined behaviour, simply ignoring code like dword x[2]; dword y = *(dword )((const char *)x + 1); which caused some problems, but I think compiler error there would appear with some regularity. Irregular pattern like this is usually a race condition or uninitialised data... Anyway, other things to try for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; DDUMP(IdeImg::GetCount()); Adding this log should might help to resolve whether IdeImg iml indeed gets damaged And possibly // alist.SetDisplay(alist.GetCount() - 1, 0, pkg.main ? bpd : pd); Comment display out, just to test if it is somehow related (the only other thing that does something with icons in the loop).
And maybe for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; DDUMP(IdeImg::GetCount()); DDUMP(pkg.package); (Just to check whether maybe it is always the same package that causes problems)
Noticed something: #2 0x00005555557a129f in IdeImg::Get (i=225) at /home/maldoror/Geliştirme/upp/devel/uppsrc/Draw/iml_source. h:113 If gdb gets it right, 225 is out of range. Which would be consistent with random crashes in release mode and probably a compiler bug. Can you try DLOG("======== LOAD"); for(int i = 0; i < packages.GetCount(); i++) { const PkInfo& pkg = packages[i]; Image icon = pkg.icon; if(IsNull(icon)) { if(pkg.main) icon = pkg.upphub ? IdeImg::HubMainPackage() : IdeImg::MainPackage(); else icon = pkg.upphub ? IdeImg::HubPackage() : IdeImg::Package(); } nest_list.Add(pkg.nest); clist.Add(pkg.package, DPI(icon, 16)); alist.Add(pkg.package, GetFileName(pkg.nest), pkg.description, icon); alist.SetDisplay(alist.GetCount() - 1, 0, pkg.main ? bpd : pd); } DLOG("~~~ LOAD"); Image Iml::Get(int i) { DDUMP(i); IImage& m = map[i]; if(!m.loaded) { Mutex::Lock __(sImlLock); if(!m.loaded) { m.image = MakeImlImage(GetId(i), [&](int mode, const String& id) { return GetRaw(mode, id); }, global_flags); m.loaded = true; } } return m.image; } If it really dumps out of range numbers in the loop, can you send me disassembly of void SelectPackageDlg::SyncList(const String& find) ?
Ok, I will do that later today. But in the meantime I have found out that TheIDE compiled with GCC with the same level of optimization (O3) didn't crash, however I tried since yesterday (on the same machine/setup). Not once. It does "appear" to be a compiler bug, but with the above tests -hopefully- we'll see. Best regards, Oblivion
Oblivion wrote on Sun, 20 October 2024 09:45 Ok, I will do that later today. But in the meantime I have found out that TheIDE compiled with GCC with the same level of optimization (O3) didn't crash, however I tried since yesterday (on the same machine/setup). Not once. It does "appear" to be a compiler bug, but with the above tests -hopefully- we'll see. Best regards, Oblivion I already have a workaround in the mind (just move image constants from inline to offline functions so that compiler does not try to optimise it), but frankly I am feeling pretty uneasy about bugged compilers... Maybe we should move to gcc?
mirek wrote on Sun, 20 October 2024 10:55 Maybe we should move to gcc? Hi, I hope that 'moving to gcc' does not mean dropping support for clang. My policy with platforms (including compilers) is to try to support more than one. When intermittent issues appear on one compiler, it is then easier to switch to another working compiler until the issue is resolved. When the code base is built to be compatible with MSC, CLANG and GCC (avoiding the known weak spots and/or bugs of each), the capability to handle new issues and avoid down time in such situations is far better. Best regards, Tom
Tom1 wrote on Sun, 20 October 2024 13:45 mirek wrote on Sun, 20 October 2024 10:55 Maybe we should move to gcc? Hi, I hope that 'moving to gcc' does not mean dropping support for clang. My policy with platforms (including compilers) is to try to support more than one. When intermittent issues appear on one compiler, it is then easier to switch to another working compiler until the issue is resolved. When the code base is built to be compatible with MSC, CLANG and GCC (avoiding the known weak spots and/or bugs of each), the capability to handle new issues and avoid down time in such situations is far better. Best regards, Tom Definitely not. Just swap preference in POSIX install script from clang to gcc. if clang++ --version >/dev/null; then echo $UMK ./uppsrc ide CLANG -brs ./theide $UMK ./uppsrc ide CLANG -brs ./theide $UMK ./uppsrc umk CLANG -brs ./umk else echo $UMK ./uppsrc ide GCC -brs ./theide $UMK ./uppsrc ide GCC -brs ./theide $UMK ./uppsrc umk GCC -brs ./umk fi -> if g++ --version >/dev/null; then echo $UMK ./uppsrc ide GCC -brs ./theide $UMK ./uppsrc ide GCC -brs ./theide $UMK ./uppsrc umk GCC -brs ./umk else echo $UMK ./uppsrc ide CLANG -brs ./theide $UMK ./uppsrc ide CLANG -brs ./theide $UMK ./uppsrc umk CLANG -brs ./umk fi Still install both build methods. Also keep CLANG in win32 where we do have a control about clang version.
Hello Mirek, I have attached the new logs. Assuming that this is a compiler bug, I still wouldn't change the default on Linux. My reasons: 1) I didn't encounter it anywhere else. I have a lot of apps, tests etc, some have heavy inlining, and built with the same clang config. They are all stable (at least, they have yet to crash because of a really puzzling error.) 2) I tend to use ArchLinux on my machines (and other distros on VM), which ships the latest LLVM/clang, so this might be a bug in the latest version of the compiler. (At least, I did not have such crashes several months ago.) 3) GCC has significantly slower compilation speed. 4) I don't know of anyone else complaining about this bug, and I am fine with using the GCC build, it works as expected. Best regards, Oblivion
Oblivion wrote on Mon, 21 October 2024 20:07 Hello Mirek, I have attached the new logs. Assuming that this is a compiler bug, I still wouldn't change the default on Linux. My reasons: 1) I didn't encounter it anywhere else. I have a lot of apps, tests etc, some have heavy inlining, and built with the same clang config. They are all stable (at least, they have yet to crash because of a really puzzling error.) 2) I tend to use ArchLinux on my machines (and other distros on VM), which ships the latest LLVM/clang, so this might be a bug in the latest version of the compiler. (At least, I did not have such crashes several months ago.) 3) GCC has significantly slower compilation speed. 4) I don't know of anyone else complaining about this bug, and I am fine with using the GCC build, it works as expected. Best regards, Oblivion ======== LOAD i = 39 i = 39 i = 39 i = 39 i = 39 i = 335 i = 335 Yep, out of range... What is clang --version? Should we file this in clang's bugzilla? I have also pushed a bunch of changes which I suppose should fix this. Can you try master?
Quote: What is clang --version? clang version 18.1.8 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Quote: I have also pushed a bunch of changes which I suppose should fix this. Can you try master? If you mean commit 509e32c, I just tried it and no, unfortunately, TheIDE is still crashing with the same behaviour. Quote: Should we file this in clang's bugzilla? At this point, yes. Best regards, Oblivion
Oblivion wrote on Mon, 21 October 2024 23:24 Quote: What is clang --version? clang version 18.1.8 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Quote: I have also pushed a bunch of changes which I suppose should fix this. Can you try master? If you mean commit 509e32c, I just tried it and no, unfortunately, TheIDE is still crashing with the same behaviour. Weird. Any chance of getting the .log? Quote: Quote: Should we file this in clang's bugzilla? At this point, yes. That would mean isolating the issue into some small example, which we are still far from Mirek
After digging deeper, I have fixed a bunch of errors related to handling non-existent files which in theory might fix the issue. Please retest master... Mirek
Hi Mirek, I've been testing it since yesterday, and all seems fine. No crashes anymore on CLANG. Best regards, Oblivion