stijnsanders / xxm

Combine Delphi and HTML code in the same source files to compile a website into a library that runs on IIS, Apache httpd, CGI, SCGI, on http.sys or raw no-frills HTTP...
http://yoy.be/xxm/
MIT License
61 stars 19 forks source link

"03 Data ADO" demo EAccessViolation #2

Closed IL2 closed 9 years ago

IL2 commented 9 years ago

After issue #1 which I've fixed for myself with v:=EmptyParam; cmd.Execute(v,v,0); appears this problem:

default_xxm An error occurred while rendering this page. xxm://demo/ EAccessViolation Access violation at address 04693E29 in module 'XXMLOC~2.DLL'. Read of address F28B562B QueryString: Post data: none xxm Local Handler (AutoBuild) 1.2.2.369

XXMLOC~2.DLL is definetely xxmLocalDev.dll. I don't know how to debug this and where in the code it happens.

stijnsanders commented 9 years ago

Don't re-use the v already used as the first parameter. Use a second wor v1

IL2 commented 9 years ago

I've made corrections in 03 Data ADO\xxmData.pas: var v,v1:OleVariant; v1:=EmptyParam; cmd.Execute(v,v1,0);

Error is still the same xxm://demo/ EAccessViolation Access violation at address 043D3E29 in module 'XXMLOC~2.DLL'. Read of address F28B562B It happens in xxmLocalDev.dll

stijnsanders commented 9 years ago

Have you tried with Null?

stijnsanders commented 9 years ago

Or perhaps try with this:

cmd.Execute(v,POleVariant(nil)^,0);
IL2 commented 9 years ago

Both v1:=Null; cmd.Execute(v,v1,0); and cmd.Execute(v,POleVariant(nil)^,0); produce the same error at the same addresses.

Btw, demo.ldb lock file is present and updated every time I call xxm:demo.

stijnsanders commented 9 years ago

Demo.ldb is not really a alock file, it always exist when an Access mdb is currently accessed. I regret these don't work since they did with a test I did on Delphi XE7, could it be possible something else in the vicinity of that code?

stijnsanders commented 9 years ago

Hey wait a minute, I just notice the exception is in module 'XXMLOC~2.DLL' with a really high address that starts with F. I noticed typically this happens whit xxm projects compiled with a 'modern' Delphi version. The release xxm*.dll's are built with Delphi 7, and newer Delphi versions have changed something binary behind the scenes about how exceptions are thrown. You might be getting an exception (perhaps a SQL syntax error!), and this access violation is the xxm dll misunderstanding this exception.

I can advise you to do one of these things:

  1. Download/clone/checkout/fork the xxm source, and build xxmLocalDev.dll with your Delphi version. (This should work just fine, if you get errors or unexpectedly much of hints or warnings, let me know.) And run your project with this dll, it should be able to understand (and handle) the exception your xxm project throws.
  2. Use the IXxmProjectEvents1 interface on your project object (in your xxmp.pas unit). This passes all exception data in strings, specifically because I ran into this binary difference of the Exception object.
  3. Do your own exception handling within the xxm project, to keep the exception within the xxm project and not let it cross over into the xxm handler process logic. If you want this to do on a large number of pages/scripts, you can use the proto folder and files to include it into the generated scripts (in the src folder).

Let me know if this puts you in a good direction to work to a solution.