View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0029677 | Lazarus | IDE | public | 2016-02-19 15:01 | 2021-03-05 18:37 |
Reporter | chronos | Assigned To | Mattias Gaertner | ||
Priority | normal | Severity | minor | Reproducibility | sometimes |
Status | assigned | Resolution | open | ||
Product Version | 1.6 | ||||
Summary | 0029677: IDE Packager exception during project opening | ||||
Description | I have project with multiple packages which are placed in project subdirectory Packages and in project manager window marked as prefered so every my application have own copy of package. To be able to edit forms with design time components some packages need to be installed to Lazarus IDE. If I switch between application this can cause some unexpected problems but perheps it shouldn't. Sometimes during project opening exception is raised. I have also for my application helper package to catch some exceptions and provide readable stack trace. See attached image with stack trace. It seems that IDE tried to replace some existing registered package with new package from project but for some bug in code it failed using uninitialized object reference. Provided callstack should be just enough for bug fixing. I can't provide example application to reproduce error yet. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | |||||
LazTarget | - | ||||
Widgetset | |||||
Attached Files |
|
related to | 0038587 | resolved | Mattias Gaertner | Packages | Project package dependencies does not resolves as expected |
|
|
|
Thanks for the backtrace. It shows a line reading a private variable, which typically means Self is wrong (usually nil), which does not look like a simple dangling pointer. Maybe the heap is corrupted. Can you reproduce the problem easily or only sometimes? |
|
I was able to reproduce it in certain state by exiting IDE and starting it cleanly and same exception was always raised. But after some testing and trying to run second IDE instance from first IDE in different directory problem disappeared. This was under Windows. Under Linux similar exceptions during opening same project also occurred but without detailed stacktrace so I can't say it is same problem. I need to gather more related info. |
|
Here log from Linux running one IDE by another IDE and opening my project. But stacktrace looks different. But now I can at least use IDE debugging tools. #0 SETACTIVE(0x0, true) at ../packager/projpackbase.pas:154 0000001 ADDPACKAGE(0x7fffeff686c0, 0x7fffec9711b0) at ../packager/packagesystem.pas:2068 0000002 OPENDEPENDENCYWITHPACKAGELINK(0x7fffeff686c0, 0x7fffec4af3c0, 0x7fffece0d580, false) at ../packager/packagesystem.pas:955 0000003 OPENDEPENDENCY(0x7fffeff686c0, 0x7fffec4af3c0, false) at ../packager/packagesystem.pas:5564 0000004 ADDPACKAGE(0x7fffeff686c0, 0x7fffec61ef90) at ../packager/packagesystem.pas:2060 0000005 OPENDEPENDENCYWITHPACKAGELINK(0x7fffeff686c0, 0x7fffec718240, 0x7fffece0d660, false) at ../packager/packagesystem.pas:955 0000006 OPENFILE(0x7fffffffce60, 0x7fffec761918 '/home/chronos/Projekty/Others/RozvadeceVsetin/LiftBox2/Packages/ConfirmationDialog/ConfirmationDialog.lpk') at ../packager/packagesystem.pas:5499 0000007 OPENDEPENDENCY(0x7fffeff686c0, 0x7fffec718240, false) at ../packager/packagesystem.pas:5545 0000008 OPENREQUIREDDEPENDENCYLIST(0x7fffeff686c0, 0x7fffec716b40) at ../packager/packagesystem.pas:5827 0000009 OPENPROJECTDEPENDENCIES(0x7fffece5dac0, 0x7fffec6216f0, true) at ../packager/pkgmanager.pas:3314 0000010 COMPLETELOADINGPROJECTINFO(0x7fffed144900) at sourcefilemanager.pas:7339 0000011 INITOPENEDPROJECTFILE(0x7fffed144900, 0x7fffec4aaf58 '/home/chronos/Projekty/Others/RozvadeceVsetin/LiftBox2/LiftBox.lpi', 16) at sourcefilemanager.pas:3606 0000012 DOOPENPROJECTFILE(0x7ffff7fbedd0, 0x7fffec4aaf58 '/home/chronos/Projekty/Others/RozvadeceVsetin/LiftBox2/LiftBox.lpi', 16) at main.pp:6211 0000013 OPENPROJECT(0x7fffed144900, 0x7fffece42a60) at sourcefilemanager.pas:4020 0000014 MNUOPENPROJECTCLICKED(0x7ffff7fbedd0, 0x7fffece42a60) at main.pp:3949 0000015 MENUITEMCLICK(0x7fffece42a60, 0x7fffece357c0) at menuintf.pas:546 0000016 MENUITEMCLICK(0x7fffece42a60, 0x7fffece357c0) at menuintf.pas:1605 0000017 CLICK(0x7fffece357c0) at include/menuitem.inc:84 0000018 DOCLICKED(0x7fffece357c0, 0) at include/menuitem.inc:282 0000019 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0 0000020 .Ld23 at :0 0000021 .Ld22 at :0 0000022 ?? at :0 0000023 ?? at :0 0000024 ?? at :0 0000025 ?? at :0 0000026 ?? at :0 0000027 ?? at :0 0000028 ?? at :0 0000029 ?? at :0 |
|
The issue is still there. Lazarus trunk 64616. In need to isolate that so I can provide some sample project for reproduction. #0 SETACTIVE(0x6c6169636570532f, true) at ../packager/projpackcommon.pas:160 0000001 ADDPACKAGE(0x7ffff59a8ba0, 0x7fffeea10c90) at ../packager/packagesystem.pas:2146 0000002 OPENDEPENDENCYWITHPACKAGELINK(0x7ffff59a8ba0, 0x7ffff4241ec0, 0x7ffff56e2140, false) at ../packager/packagesystem.pas:1007 0000003 OPENDEPENDENCY(0x7ffff59a8ba0, 0x7ffff4241ec0, false) at ../packager/packagesystem.pas:5850 0000004 ADDPACKAGE(0x7ffff59a8ba0, 0x7fffedd1eb30) at ../packager/packagesystem.pas:2138 0000005 REPLACEPACKAGE(0x7ffff59a8ba0, 0x0, 0x7fffedd1eb30) at ../packager/packagesystem.pas:2205 0000006 OPENDEPENDENCYWITHPACKAGELINK(0x7ffff59a8ba0, 0x7ffff7fc7b60, 0x7fffee862640, false) at ../packager/packagesystem.pas:1009 0000007 OPENFILE(0x7fffffffc540, 0x7fffeddb6f58 '/home/chronos/Projekty/zd'...) at ../packager/packagesystem.pas:5784 0000008 OPENDEPENDENCY(0x7ffff59a8ba0, 0x7ffff7fc7b60, false) at ../packager/packagesystem.pas:5830 0000009 UPDATEBROKENDEPENDENCIESTOPACKAGE(0x7ffff59a8ba0, 0x7fffedcc36d0) at ../packager/packagesystem.pas:935 0000010 ADDPACKAGE(0x7ffff59a8ba0, 0x7fffedcc36d0) at ../packager/packagesystem.pas:2143 0000011 OPENDEPENDENCYWITHPACKAGELINK(0x7ffff59a8ba0, 0x7ffff5113800, 0x7ffff56e0840, false) at ../packager/packagesystem.pas:1007 0000012 OPENDEPENDENCY(0x7ffff59a8ba0, 0x7ffff5113800, false) at ../packager/packagesystem.pas:5850 0000013 ADDPACKAGE(0x7ffff59a8ba0, 0x7fffedcc9710) at ../packager/packagesystem.pas:2138 0000014 OPENDEPENDENCYWITHPACKAGELINK(0x7ffff59a8ba0, 0x7fffede68400, 0x7ffff56e1540, false) at ../packager/packagesystem.pas:1007 0000015 OPENFILE(0x7fffffffd140, 0x7fffeddb5458 '/home/chronos/Projekty/zd'...) at ../packager/packagesystem.pas:5784 0000016 OPENDEPENDENCY(0x7ffff59a8ba0, 0x7fffede68400, false) at ../packager/packagesystem.pas:5830 0000017 OPENREQUIREDDEPENDENCYLIST(0x7ffff59a8ba0, 0x7fffede68400) at ../packager/packagesystem.pas:6121 0000018 OPENPROJECTDEPENDENCIES(0x7fffeec30c00, 0x7fffee00eed0, true) at ../packager/pkgmanager.pas:3283 0000019 COMPLETELOADINGPROJECTINFO at sourcefilemanager.pas:7452 0000020 INITOPENEDPROJECTFILE(0x7ffff54bf0d8 '/home/chronos/Projekty/zd'..., [OFADDTORECENT]) at sourcefilemanager.pas:3685 0000021 DOOPENPROJECTFILE(0x7ffff5aefd30, 0x7ffff54bf0d8 '/home/chronos/Projekty/zd'..., [OFADDTORECENT]) at main.pp:6502 0000022 OPENPROJECT(0x7ffff5654e00) at sourcefilemanager.pas:4181 0000023 MNUOPENPROJECTCLICKED(0x7ffff5aefd30, 0x7ffff5654e00) at main.pp:4288 0000024 MENUITEMCLICK(0x7ffff5654e00, 0x7fffee02c140) at menuintf.pas:547 0000025 MENUITEMCLICK(0x7ffff5654e00, 0x7fffee02c140) at menuintf.pas:1699 0000026 CLICK(0x7fffee02c140) at include/menuitem.inc:83 0000027 DOCLICKED(0x7fffee02c140, ) at include/menuitem.inc:296 0000028 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0 |
|
Here output with package search Verbosity on. Here TemplateGenerics package which is freed somewhere during its usage . It is accessed as undefined reference in AddPackage method on line 2146 as visible in stacktrace above. Basically in AddPackage method APackage parameters object is invalidated (deleted/replaced) in UpdateBrokenDependenciesToPackage call. UpdateBrokenDependenciesToPackage finds same package as provided in APackage as Dependency and can replace it. So solution can be either not to Delete old package in ReplacePackage method but propertly Assign new package to old package so package reference would be kept. Or somehow inform AddPackage method that its APackage is no longer accessible and it should look for new replacement package. But there is also problem with update locking. If oldpackage is removed during updating then locks doesn't match. So its more complicated. Info: (lazarus) Open dependency Project: ZdechovNET uses ModularSystem v Packages/ModularSystem/ModularSystem.lpk ... Info: (lazarus) Open dependency [ModularSystem]: trying resolved preferred filename: "/home/chronos/Projects/zdechovnet/trunk/Packages/ModularSystem/ModularSystem.lpk" ... Info: (lazarus) Open dependency: trying "ModularSystem" in 2 links: "/home/chronos/Projects/zdechovnet/trunk/Packages/ModularSystem/ModularSystem.lpk" ... Info: (lazarus) Open dependency: package file found: "/home/chronos/Projects/zdechovnet/trunk/Packages/ModularSystem/ModularSystem.lpk". Parsing lpk ... Info: (lazarus) Open dependency [ModularSystem]: Success: "/home/chronos/Projects/zdechovnet/trunk/Packages/ModularSystem/ModularSystem.lpk" Info: (lazarus) Open dependency Package: ModularSystem 0.1 uses Common ... Info: (lazarus) Open dependency: trying "Common" in 2 links: "/home/chronos/Projects/2048/trunk/Packages/Common/Common.lpk" ... Info: (lazarus) Open dependency: package file found: "/home/chronos/Projects/2048/trunk/Packages/Common/Common.lpk". Parsing lpk ... Info: (lazarus) Open dependency [Common]: Success: "/home/chronos/Projects/2048/trunk/Packages/Common/Common.lpk" Info: (lazarus) Open dependency Package: Common 0.7 uses LCL ... Info: (lazarus) Open dependency [LCL]: Success: was already loaded Info: (lazarus) Open dependency Package: Common 0.7 uses FCL (>=1.0) ... Info: (lazarus) Open dependency [FCL]: Success: was already loaded Info: (lazarus) Open dependency Project: ZdechovNET uses Common in Packages/Common/Common.lpk ... Info: (lazarus) Open dependency [Common]: Success: was already loaded Info: (lazarus) Open dependency [Common]: trying resolved preferred filename: "/home/chronos/Projects/zdechovnet/trunk/Packages/Common/Common.lpk" ... Info: (lazarus) Open dependency: trying "Common" in 0 links: "/home/chronos/Projects/zdechovnet/trunk/Packages/Common/Common.lpk" ... Info: (lazarus) Open dependency: package file found: "/home/chronos/Projects/zdechovnet/trunk/Packages/Common/Common.lpk". Parsing lpk ... Info: (lazarus) Open dependency [Common]: Success: "/home/chronos/Projects/zdechovnet/trunk/Packages/Common/Common.lpk" Info: (lazarus) replacing package "/home/chronos/Projects/2048/trunk/Packages/Common/Common.lpk" with "/home/chronos/Projects/zdechovnet/trunk/Packages/Common/Common.lpk" Info: (lazarus) Open dependency Package: Common 0.7 uses LCL ... Info: (lazarus) Open dependency [LCL]: Success: was already loaded Info: (lazarus) Open dependency Package: Common 0.7 uses TemplateGenerics ... Info: (lazarus) Open dependency: trying "TemplateGenerics" in 2 links: "/home/chronos/Projects/xtactics/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" ... Info: (lazarus) Open dependency: package file found: "/home/chronos/Projects/xtactics/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk". Parsing lpk ... Info: (lazarus) Open dependency [TemplateGenerics]: Success: "/home/chronos/Projects/xtactics/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" Info: (lazarus) Open dependency Package: TemplateGenerics 0.4 uses LCLBase ... Info: (lazarus) Open dependency [LCLBase]: Success: was already loaded Info: (lazarus) Open dependency Package: TemplateGenerics 0.4 uses FCL (>=1.0) ... Info: (lazarus) Open dependency [FCL]: Success: was already loaded Info: (lazarus) Open dependency Project: ZdechovNET uses TemplateGenerics in Packages/TemplateGenerics/TemplateGenerics.lpk ... Info: (lazarus) Open dependency [TemplateGenerics]: Success: was already loaded Info: (lazarus) Open dependency [TemplateGenerics]: trying resolved preferred filename: "/home/chronos/Projects/zdechovnet/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" ... Info: (lazarus) Open dependency: trying "TemplateGenerics" in 0 links: "/home/chronos/Projects/zdechovnet/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" ... Info: (lazarus) Open dependency: package file found: "/home/chronos/Projects/zdechovnet/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk". Parsing lpk ... Info: (lazarus) Open dependency [TemplateGenerics]: Success: "/home/chronos/Projects/zdechovnet/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" Info: (lazarus) replacing package "/home/chronos/Projects/xtactics/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" with "/home/chronos/Projects/zdechovnet/trunk/Packages/TemplateGenerics/TemplateGenerics.lpk" Info: (lazarus) Open dependency Package: TemplateGenerics 0.4 uses LCLBase ... Info: (lazarus) Open dependency [LCLBase]: Success: was already loaded Info: (lazarus) Open dependency Package: TemplateGenerics 0.4 uses FCL (>=1.0) ... Info: (lazarus) Open dependency [FCL]: Success: was already loaded Info: (lazarus) Open dependency Package: Common 0.7 uses TemplateGenerics ... Info: (lazarus) Open dependency [TemplateGenerics]: Success: was already loaded |
|
> Here TemplateGenerics package which is freed somewhere during its usage Why is it freed during its usage? How to reproduce? Apparently you have a systematic way to reproduce the problem, others should be able to repeat those same steps. Why nobody else has never seen this problem? Your use case is somehow special. |
|
Here you can find three same projects with three packages. All three packages are referenced as preferred from project and package2 depends on package1 and package3 depends on both package1 and package2. It I am switching between all three projects I can't see deterministic reproducible error. But when I open for example project1, then select menu Project - Close project and exit Lazarus. Then after new Lazarus start it will ask me which project I want to open. If I select to open project2 or project 3 then I got exception. If I open project1 then it will open it correctly. So to manifest that error we need to open different project with different local packages so ReplacePackage method would kick in. Workaround until this gets fixed is to remove /home/user/.lazarus/packagefiles.xml file which contains list of previously used packages. Removal of this file will avoid ReplacePackage situation and a project would be opened without such error. |
|
Its freed because required package already exists in different previously opened project. So the package previously loaded from different location is "replaced" by preferred location and reloaded again. I was finally able to put some project with which this can be reproduced. See my previous post. This error came up many times during past years but somehow I was able to open my project. Sometimes by deletion of Lazarus settings or just trying many ways until it was finally opened somehow. So it was not easy to reproduce and needed deeper investigation. And my case may be special. I use multiple packages and usually I refer those packages from main project as preferred and I always copy packages into project source tree so entire project is independent and can be opened with just Lazarus itself. I guess other people do that differently and have packages only one place so location of packages don't change much for them. Now after several years I see that if I don't report this in reproducible way with detailed analysis then nobody would be able to fix this. So that is what I did right now. Still I was not able to come up with some solution how to fix this. |
|
Ok, I finally was able to reproduce, although only sometimes when switching projects. The crash must be fixed but IMO you use packages in a wrong way. Their whole purpose is to share code between projects. If a piece of code is used only in one project, you don't need a package for it. Also having many different packages with the same name is very misleading and error prone. Interestingly, the package dependencies of your projects include path, like : Package1 in package1/Package1.lpk How did you get the path there? Did you edit project .lpi file manually. I don't get the same effect by using the GUI. |
|
Yes, it behaves kind of unexpectedly. But with described steps you should be able to reproduce it repeatedly. No, purpose of packages is still met. This is more about software configuration. I need to have copy of all used packages checked-in in source control system so I can reproduce exactly any previous state of software and I can redistribute source code as zip files where all necessary parts are present. No need to download some external packages during first use. I keep main source of all packages in central repository https://svn.zdechov.net/PascalClassLibrary/ So here is main source of up to date source code for all packages. I also tried before manual download and instalation of packages, using svn:external or kept zipped source of packages with project. But all of that was too fragile in long run. Also I don't have different packages with same name. But if I use package1 and package2, and package2 also depends on package1, then I need to tell my project where to find those packages. So I always add reference to all used packages to main project. So correct version of package will be used. I an not sure what you mean by include path in package dependencies. If package is set as preferred and is placed in subdirectory then it will be with relative path. I created that sample project simply by clicking in gui. No manual lpi or lpk modification. I wanted to create sample project which is similar to my project. With inter-packages dependencies and multiple packages/project depending on same package. |
|
> I created that sample project simply by clicking in gui. I see 2 ways to add a package dependency to a project. 1. In Project Inspector add a new requirement and select a package name from a list. 2. In Package editor Use -> Add to Project. In both cases I get only the package name without a path. The " in package1/Package1.lpk" part is missing. The bug is a nasty one. I hope Mattias has an idea how it should be fixed. I personally would suggest that 2 packages with the same name are not allowed. You could also easily change the names of your packages. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-02-19 15:01 | chronos | New Issue | |
2016-02-19 15:01 | chronos | File Added: pkgerror.png | |
2016-02-19 15:31 | Mattias Gaertner | LazTarget | => - |
2016-02-19 15:31 | Mattias Gaertner | Note Added: 0090136 | |
2016-02-19 15:31 | Mattias Gaertner | Assigned To | => Mattias Gaertner |
2016-02-19 15:31 | Mattias Gaertner | Status | new => feedback |
2016-02-19 16:35 | chronos | Note Added: 0090140 | |
2016-02-19 16:35 | chronos | Status | feedback => assigned |
2016-02-19 16:39 | chronos | Note Added: 0090141 | |
2021-02-18 14:50 | chronos | Note Added: 0128994 | |
2021-02-18 17:19 | chronos | Note Added: 0128996 | |
2021-02-18 18:07 | Juha Manninen | Note Added: 0128997 | |
2021-02-18 18:36 | chronos | Note Added: 0128999 | |
2021-02-18 18:36 | chronos | File Added: packager_error.zip | |
2021-02-18 18:47 | chronos | Note Added: 0129000 | |
2021-02-18 21:06 | Juha Manninen | Note Added: 0129003 | |
2021-02-18 21:07 | Juha Manninen | Note Edited: 0129003 | View Revisions |
2021-02-18 21:09 | Juha Manninen | Note Edited: 0129003 | View Revisions |
2021-02-18 22:12 | chronos | Note Added: 0129004 | |
2021-02-19 12:17 | Juha Manninen | Note Added: 0129015 | |
2021-02-19 15:01 | Juha Manninen | Note Edited: 0129015 | View Revisions |
2021-03-05 18:37 | Juha Manninen | Relationship added | related to 0038587 |