View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001023 | JEDI VCL | 00 JVCL Components | public | 2003-07-07 06:06 | 2004-01-29 10:35 |
| Reporter | ckin | Assigned To | obones | ||
| Priority | normal | Severity | block | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Summary | 0001023: Nullpointer exception in jvcl200_d70 | ||||
| Description | After a new installation of Delphi Professional 7 (Build 4.453) and installion JEDI I got a nullpointer exception in jvcl200_d70. I'm using Windows XP. On a identically installed W2K Machine it works without this error. I'm using JEDI 2.10 stable with updates. I located the problem in jclsysinfo at the line with CpuInfo.MMX and replaced it with old jvcl code. Now it seems to work without the null pointer exception. procedure GetCpuInfo(var CpuInfo: TCpuInfo); begin CpuInfo := CPUID; CpuInfo.IsFDIVOK := TestFDIVInstruction; if CpuInfo.HasInstruction then begin if (CpuInfo.Features and TSC_FLAG) = TSC_FLAG then GetCpuSpeed(CpuInfo.FrequencyInfo); //Replaced because of WinXP Error if (CpuInfo.Features and MMX_FLAG) = MMX_FLAG then CpuInfo.MMX := True else CpuInfo.MMX := False; //Original only this line // CpuInfo.MMX := (CpuInfo.Features and MMX_FLAG) = MMX_FLAG; end; end; | ||||
| Additional Information | After the first installation everything works fine when starting delphi. After the second start of Delphi the error occurs everythime. | ||||
| Tags | No tags attached. | ||||
| has duplicate | 0001167 | closed | Robert Rossmair | JEDI Code Library | EZeroDivide is raised in GetCPUSpeed |
| has duplicate | 0001074 | closed | Robert Rossmair | JEDI Code Library | Dr. Watson when GetCPUInfo is called |
| has duplicate | 0001112 | closed | Robert Rossmair | JEDI Code Library | Linking JclGraphUtils GPFs under XP Home Edition |
| has duplicate | 0001285 | closed | remkobonte | JEDI VCL | AV on startup |
| has duplicate | 0001286 | closed | remkobonte | JEDI VCL | division by zero on fast machines |
| has duplicate | 0001288 | closed | remkobonte | JEDI VCL | EZeroDivide in JclSysinfo |
| has duplicate | 0001295 | closed | Robert Rossmair | JEDI Code Library | DevideByZero Error |
| has duplicate | 0001334 | closed | remkobonte | JEDI VCL | TJvTrayIcon; TJvFormPlacement imcompatible with approx 10% of Win XP machines |
|
|
The error seems to be more realated to cpu processor than to windows. It appears on a Pentium 4 HT 2,6 GHz. |
|
|
The jvcl code replacement had no use, the error still occurs. Installing JclSysInfo BugFix attached to Bug 0000401 doesn't work either. At starting Delphi 7 (german version) there appears always the error: "Package c:ProgrammeBorlandDelphi7ProjectsBplJVCL200_D70.bpl cannot be loaded. Division by zero. Do you want to load this package at the next project?" |
|
|
I'm quite glad you noticed your replacement was no use, it does in 4 lines what was done in one... However, as not much of us have access to a P4HT, I'd like you to help us track that one. The null pointer exception might come from the fact the CpuInfo is not initialized (or CPUID is null). So if you could examine the value of CpuInfo when the error is coming in debug mode, that would be helpful. Also, could you give us a dump of the call stack at the moment of the call (view, debug windows, call stack). |
|
|
Everytime at startup appears the message "Package c:ProgrammeBorlandDelphi7ProjectsBplJVCL200_D70.bpl cannot be loaded. Division by zero. Do you want to load this package at the next project?" Only sometimes the runtime error message 'runtime error 216 at 00404316' appears when starting an application within the Delphi IDE. The following information I could extract for you: Stack: ====== GetCpuInfo(???) SetupFunctions JclGraphUtils Debug: ====== MMX_FLAG value is 8388608 TSC_FLAG value is 16 CpuInfo value is not defined Event protocol (translated from german): ================ First random-exception at $77E53887. Exception-class EZeroDivide with message 'division by zero' Compiler stops at line 2206 in jvclinfo 'CpuInfo.MMX := (CpuInfo.Features and MMX_FLAG) = MMX_FLAG;' |
|
|
Outside the Delphi IDE there is no way to start the compiled application. There appears everytime "Runtime error 216 at 00404316" and then the application finishes. So this seems to be a quite severe bug of the version 2.1 for the intel pentium 4 ht processors. Fortunately the JEDI VCL version 2.0 works without this bug. edited on: 07-14 22:33 edited on: 07-14 22:33 |
|
|
So you say that version 2.0 is working ? In this case, can you give me the exact code of the CPUID function (it is pure assembly), and the GetCPUInfo procedure ? I'll then be able to look at the differences and let you know what's wrong. Thanks for your patience |
|
|
Sorry for the late reply. I use now the JVCL 2.0 Full Install from the download page: JCL122+JVCL200FinalFullInstall.zip With the following files of the 2.1 Version I got the errors: Full Install JCL+JVCL210FullInstall.zip Also tried the following bug fixes which didn't solve the problem: 0000401-JclSysInfo.zip JVCL210FIX030313.zip JvInterpreterUpdateTo2_10.zip |
|
|
Hi Sorry for the delay, but it's very hard to reproduce a bug without having the hardware causing it at hand. Peter suggested you try to replace the GetCPUSpeed function in JclSysInfo.pas with the one below. Please let us know if that fixes the problem. Thanks for your patience function GetCPUSpeed(var CpuSpeed: TFreqInfo): Boolean; var T0, T1: TULargeInteger; CountFreq: TULargeInteger; Freq, Freq2, Freq3, Total: Integer; TotalCycles, Cycles: Int64; Stamp0, Stamp1: Int64; TotalTicks, Ticks: Cardinal; Tries, Priority: Integer; Thread: THandle; begin Stamp0 := 0; Stamp1 := 0; Freq := 0; Freq2 := 0; Freq3 := 0; Tries := 0; TotalCycles := 0; TotalTicks := 0; Total := 0; Thread := GetCurrentThread(); Result := QueryPerformanceFrequency(Int64(CountFreq)); if Result then begin while ((Tries < 3 ) or ((Tries < 20) and ((Abs(3 * Freq - Total) > 3) or (Abs(3 * Freq2 - Total) > 3) or (Abs(3 * Freq3 - Total) > 3)))) do begin Inc(Tries); Freq3 := Freq2; Freq2 := Freq; QueryPerformanceCounter(Int64(T0)); T1.LowPart := T0.LowPart; T1.HighPart := T0.HighPart; Priority := GetThreadPriority(Thread); if Priority <> THREAD_PRIORITY_ERROR_RETURN then SetThreadPriority(Thread, THREAD_PRIORITY_TIME_CRITICAL); try while (T1.LowPart - T0.LowPart) < 50 do begin QueryPerformanceCounter(Int64(T1)); Stamp0 := ReadTimeStampCounter; end; T0.LowPart := T1.LowPart; T0.HighPart := T1.HighPart; while (T1.LowPart - T0.LowPart) < 1000 do begin QueryPerformanceCounter(Int64(T1)); Stamp1 := ReadTimeStampCounter; end; finally if Priority <> THREAD_PRIORITY_ERROR_RETURN then SetThreadPriority(Thread, Priority); end; Cycles := Stamp1 - Stamp0; Ticks := T1.LowPart - T0.LowPart; Ticks := Ticks * 100000; if CountFreq.LowPart <> 0 then Ticks := Round(Ticks / (CountFreq.LowPart / 10)) else Ticks := 0; TotalTicks := TotalTicks + Ticks; TotalCycles := TotalCycles + Cycles; if Ticks <> 0 then Freq := Round(Cycles / Ticks) else Freq := 0; Total := Freq + Freq2 + Freq3; end; if TotalTicks <> 0 then begin Freq3 := Round((TotalCycles * 10) / TotalTicks); Freq2 := Round((TotalCycles * 100) / TotalTicks); end else begin Freq3 := 0; Freq2 := 0; end; if Freq2 - (Freq3 * 10) >= 6 then Inc(Freq3); if TotalTicks <> 0 then CpuSpeed.RawFreq := Round(TotalCycles / TotalTicks) else CpuSpeed.RawFreq := 0; CpuSpeed.NormFreq := CpuSpeed.RawFreq; Freq := CpuSpeed.RawFreq * 10; if (Freq3 - Freq) >= 6 then Inc(CpuSpeed.NormFreq); CpuSpeed.ExTicks := TotalTicks; CpuSpeed.InCycles := TotalCycles; CpuSpeed.NormFreq := RoundFrequency(CpuSpeed.NormFreq); Result := True; end; end; |
|
|
Hi, I've got the same error message after installing JVCL210 : 'Package c:Program FilesBorlandDelphi7ProjectsBplJVCL200_D70.bpl cannot be loaded. Division by zero. Do you want to load this package at the next project?'. I've a Dell Workstation 450 with Dual Cpu XEON HT 2.4 Ghz with XP Pro SP1. If I write a little app that invoke GetCpuInfo from jclSysInfo all work fine without any error. How can investigate further this problem ? On my notebook P4 with XP SP1 the installation of JVCL is working fine and the package is correctly loaded by D7 at startup. Thank you for your attention. |
|
|
Please check 0000401 and apply the fix for JclSysInfo.pas. Let us know if it makes any difference. |
|
|
I've applied the fix for JclSysInfo.pas related to bug 0000401. I've forced a complete build of the 2 Packages JVCL200_X70 without problem. When I've tried to install del Design time package i've received an exception of 'Divide by 0'. How can I do to resolve this problem ? Thanks |
|
|
I can also reproduce this problem on my hyperthreading machine. I will dig into the subject, if anyone have work in progress please contact me. I know of at least one benchmark application that report my CPU speed as negative, so it gotta be a HT problem |
|
|
Wabit (and others that have this problem and want to work on it), please post a message on the JVCL newsgroup at: news://forums.talkto.net/jedi.vcl or news://forums.talkto.net/jedi.jcl so we can send you test projects. (No JVCL/JCL developer has a hyperthreading machine so we can't test it) You can also contact me directly at: remkobonte at myrealbox dot com |
|
|
The latest JCL source code has been posted to CVS and jedi.binaries on forums.talkto.net Please use that code, it won't generate Exceptions |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2004-01-24 18:30 | Robert Rossmair | Relationship added | has duplicate 0001112 |
| 2004-01-29 10:35 |
|
Status | resolved => closed |
| 2004-02-17 10:27 | remkobonte | Relationship added | has duplicate 0001334 |