![]() |
#1 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
Debugging advice
i'm suffering over a problem occuring with my script and i'm having a difficult time pinpointing it. what this script does is locating and copying some files and using textreplace. in most cases it works without problems, but when a large number of files is involved (in my case 2530) the installer will freeze. to make things worse this does not happen always, just occasionally.
i'm looking for some hints on how to find the bug. i've already disabled various parts of the script, but without gaining any knowledge. all i can say is, this happens when working with a lot of files and i believe i did not have this problem when using other (slower) functions to replace text or to locate files. is there anything wrong with my textreplace calls? can they be optimized? any other tips on how to narrowing down the problem? any help is greatly appreciated. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
In cases like this I usually just add some messgeboxes to the code to find the point where things go wrong, but in this case Nsisdbg plug-in is probably much better choice.
With Nsisdbg plug-in use the nsisdbg::sendtolog call to track the progress of your script. Edit: I just realized that the Nsisdbg plug-in download link is is dead. I uploaded the plug-in on my site. |
![]() |
![]() |
![]() |
#3 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
i shall also note that i only get those problems on windows 7 (both 32 and 64 bit), not on windows xp.
|
![]() |
![]() |
![]() |
#4 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
thanks {_trueparuex^}, i actually tried all of this before - to no success. as i suspect the number of files to be responsible, i wonder if this could be a memory issue. i do have 8gb ram and enough space on all drives, so that should not be the case. i'm also not exceeding the string-length (i'm using the large string build), so i wonder where else i can look. what puzzles me, why does it work on xp in a virtual machine (with 2gb ram)
|
![]() |
![]() |
![]() |
#5 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
it appears i could find the problem in my script, so i wanted to resolve it in case someone runs into similar problems.
the problem appeared (occasionally, only on windows vista or later) when setting the outdir when the path existed already code: a simple IfFileExists fixed the issue, but i changed the code to this code: in the following a couple of files were copied, so i didn't really need SetOutPath and changed it to CreateDirectory. for reasons unknown, it was IfFileExists that made the difference! |
![]() |
![]() |
![]() |
#6 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
i continue to have this bug at a later point. again it's caused by a simple copy operation, just this time i can't figure out when and why it's happening (again it happens occasionally and only on vista/win7.) i have a test scenario which helps me testing this on 312 examples, but the result continue to be entirely random, though certain test-files tend to trigger the bug more often.
the line in question is this: code: the source-file is located in $PROGRAMFILES and is a dll with a different file-extension. the problem appears on elevated and usermode installers. any clues, cause i'm clueless! |
![]() |
![]() |
![]() |
#7 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
here are a couple of things i tried
1. extract the file from the installer rather than copying it -> works 2. copying the file using the full path as on my system -> works 3. checking if the source-file and the target-folder exist -> yes 4. checking if $EXEDIR is correct -> yes $EXEDIR = C:\Program Files (x86)\whyEye.org\PimpBot\ape CopyFile "$EXEDIR\ape\addborder.ape" "$MyTempDir\ape\addborder" -> crashes installer CopyFile "C:\Program Files (x86)\whyEye.org\PimpBot\ape\addborder.ape" "$MyTempDir\ape\addborder" -> works i'm clueless, please please help me! |
![]() |
![]() |
![]() |
#8 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
What if you call API directly, instead of CopyFiles?
|
![]() |
![]() |
![]() |
#10 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Just a random thought: Have you tried this on other PCs? Win Vista/7 are very clunky with file copying. It's possible that bad RAM or a bad HDD causes it to blow.
|
![]() |
![]() |
![]() |
#11 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
i asked some friends to test it, but they didn't get any problems (well, i'd love to test it myself). i replaced my ram since this first came up and i tried various disks including ssd, harddrives and ramdisk (hence i'm using $MyTempDir instead of $PLUGINSDIR). i have another windows 7 (32-bit) running in a virtual machine (same problem) and also windows xp (where i NEVER get this problem.) i'm going to install windows 7 on vmware on my laptop and see what happens..
further, i've tested various nsis builds (standard and longstr) it's interesting that there have been reports regarding CopyFiles and windows 7 on this forum, though i didn't find a case that really crashes the installer. having found the exact line where this problem occurs, i wonder if it could still be caused by something else. not sure what i should be looking for. |
![]() |
![]() |
![]() |
#12 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
same thing on the other computer
![]() |
![]() |
![]() |
![]() |
#13 |
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
It shouldn't lead to a crash, but if $EXEDIR already has a trailing 'ape', your copyfile command is wrong.
|
![]() |
![]() |
![]() |
#14 | |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
Quote:
anyway, i've figured out a workaround so i'm not going to break my head over this one. thanks for all the advice! |
|
![]() |
![]() |
![]() |
#15 |
Senior Member
Join Date: Dec 2005
Location: Glow
Posts: 285
|
I think you have a heap corruption issue here. The crash.log shows it crashes in ntdll.dll with memory access violation which I think is probably result of heap corruption. If this is the case you probably also get crashes with exception code 0xc0000374 (STATUS_HEAP_CORRUPTION). And the cause for heap corruption would be most likely a third party plug-in.
![]() PaR |
![]() |
![]() |
![]() |
#16 | |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
Quote:
|
|
![]() |
![]() |
![]() |
#17 |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
i commented out the two plugins in question each at a time (TextReplace and Locate) and it appears that either the locate plugin is buggy or my code using it produces the bug (will look into it!) in either case, the installer didn't crash once in 2,500 test runs.
the only let down is this: what happens if it's to blame on the plugin. it appears it's no longer maintained by the author ![]() |
![]() |
![]() |
![]() |
#18 | |
Join Date: Sep 2003
Posts: 27,873
|
Quote:
![]() -daz |
|
![]() |
![]() |
![]() |
#19 | |
Forum King
Join Date: Jan 2002
Location: AT-DE
Posts: 3,366
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#20 |
Join Date: Sep 2003
Posts: 27,873
|
something like that though i'd prefer a milkdrop 3 which supports avs presets
![]() -daz |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|