Search code examples
delphidelphi-7access-violation

Troubleshooting Access Violation at Address. Read of Address 00000000


The same version of Delphi 7 Code has been deployed at computers throughout our organization.

Each time user A accesses record Z on computer F1, the following error is displayed:

Access violation at address 00642E83 in module 'foo.exe'. Read of address 00000000

I've followed the same steps on my own computer with my user, and on another computer with another person's user, and have been unable to replicate it (and hence, can't debug...).

Additional Info as requested (not sure how helpful this will be)

  • Record Z is a row in an Interbase DB holding contact and call history of people who have called in.
  • All the computers in our org use the same build of Windows 7.

So when...

  • User B accesses record Z on computer F2 there is no error.
  • User C accesses record Z on computer F3 there is no error.
  • User A accesses record Z on computer F4 there is no error.
  • User A accesses record Z on computer F1 (after reboot) there is the same error at the same addresses mentioned.

It appears that computer F1 is the culprit. However, at this point, I'm not sure how to troubleshoot further.

Any suggestions?


Solution

  • At the moment, there isn't enough information for us to debug this. But there's enough to give you some useful clues:

    Access violation, read of address 00000000, means that someone tried to dereference a null pointer. This is usually (but not always) an object that hasn't been constructed yet.

    Access violation at an address like 00642E83 (a number somewhere in the process's space, as opposed to something like 00000000 or FFFFFFF8) means that it was data access. If you'd gotten a number at one or the other extreme of the address space for this value, that would indicate that you tried to jump to an invalid code address; this usually happens if you tried to call a virtual method on an object that's still nil.

    The suggestion given by "500 - Internal Server Error" in the comments probably won't help, because address spaces that things get loaded into aren't always consistent from one system to another, but he's on the right track.

    IF you can't reproduce it in your debugger, but it consistently reproduces on a certain system, you need to get useful debugging information from that system. There are two ways to do this: Attach a debugger on their system (not very feasible in most cases) or using an error logger.

    An error logger is a very useful tool in modern development, and I'd recommend one for any product that's going to be deployed to any computer you do not control. Basically, it installs some extra code into your program that catches unhandled exceptions and generates an error report to send back to you. The report will generally contain various useful pieces of information, including a full stack trace. When you have one of those, access violations are usually really easy to track down and solve.

    The most common error logging tools for Delphi are EurekaLog and MadExcept. I've used both (EurekaLog in professional work and MadExcept for personal development) and I would recommend either one to any Delphi developer who needs an error logger. What you need to do is rebuild your project with one of these two tools, send it to the client who has the computer that causes things to misbehave, and tell them to reproduce the error and send you back the error report it generates. That should give you the information you need to track down the bug.