Unecpected crash after update from 5.6.59 to 5.7.15 in a C++ program

View: New views
3 Messages — Rating Filter:   Alert me  

Unecpected crash after update from 5.6.59 to 5.7.15 in a C++ program

by Uwe Lesta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have a windows C++ application using SWI-Prolog. After updating from 5.6.59 to 5.7.15
(headers, lib, dll, and qlf files) the application crash with an Access violation.

The prolog part alone work. (plunit tested)

The program do some (which work with version 5.6.59)

PL_initialise(argc, argv);
PL_cleanup(0);

If I don't do the PL_cleanup(0) it also work until memory is gone.

Any ideas are welcome.




Unhandled exception at 0x10010876 (LIBPL.dll) in ptwags.exe: 0xC0000005: Access violation reading location 0x0000000c.

LIBPL.dll!PL_open_query(module * ctx=0x00000000, int flags=16, procedure * proc=0x0d2107bc, unsigned long args=176)
Line 1435 + 0xc bytes C
LIBPL.dll!PL_call_predicate(module * ctx=0x00000000, int flags=16, procedure * pred=0x0d2107bc, unsigned long h0=176)
Line 3183 + 0x1b bytes C
LIBPL.dll!auto_define_gvar(unsigned long name=268993065)  Line 180 + 0x10 bytes C
LIBPL.dll!getval(unsigned long var=268993558, unsigned long value=283140, PL_local_data * __PL_ld=0x000000a5)  Line 218
+ 0xa bytes C
LIBPL.dll!pl_b_getval2_va(unsigned long PL__t0=7, int PL__ac=0, foreign_context * PL__ctx=0x203a0000)  Line 262 + 0xf
bytes C
00000007()



--

Kind regards

Uwe Lesta


_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

Re: Unecpected crash after update from 5.6.59 to 5.7.15 in a C++ program

by Jan Wielemaker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Uwe,

On Wednesday 14 October 2009 11:12:36 am Uwe Lesta wrote:

> I have a windows C++ application using SWI-Prolog. After updating from
> 5.6.59 to 5.7.15 (headers, lib, dll, and qlf files) the application crash
> with an Access violation.
>
> The prolog part alone work. (plunit tested)
>
> The program do some (which work with version 5.6.59)
>
> PL_initialise(argc, argv);
> PL_cleanup(0);
>
> If I don't do the PL_cleanup(0) it also work until memory is gone.

AFAIK, PL_cleanup() is broken since very long (well, a single
PL_initialise() ... PL_cleanup() is fine, but repeated usage is broken).
I'm not very keen in trying to get this right.  Trying to get unloading
the foreign resources (DLLs) is very complicated, especially due to the
various callbacks they may have been registered.

Typically, you wouldn't want to re-intialize anyway, because that is
fairly slow. If you are happy with such long delays, why don't you run
Prolog in a separate process? That makes restarting safe and easy.

So, what is it that requires you app to re-intialize?

        Cheers --- Jan

> Any ideas are welcome.
>
>
>
>
> Unhandled exception at 0x10010876 (LIBPL.dll) in ptwags.exe: 0xC0000005:
> Access violation reading location 0x0000000c.
>
> LIBPL.dll!PL_open_query(module * ctx=0x00000000, int flags=16, procedure *
> proc=0x0d2107bc, unsigned long args=176) Line 1435 + 0xc bytes C
> LIBPL.dll!PL_call_predicate(module * ctx=0x00000000, int flags=16,
> procedure * pred=0x0d2107bc, unsigned long h0=176) Line 3183 + 0x1b bytes C
> LIBPL.dll!auto_define_gvar(unsigned long name=268993065)  Line 180 + 0x10
> bytes C LIBPL.dll!getval(unsigned long var=268993558, unsigned long
> value=283140, PL_local_data * __PL_ld=0x000000a5)  Line 218 + 0xa bytes C
> LIBPL.dll!pl_b_getval2_va(unsigned long PL__t0=7, int PL__ac=0,
> foreign_context * PL__ctx=0x203a0000)  Line 262 + 0xf bytes C
> 00000007()

_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

Re: Unecpected crash after update from 5.6.59 to 5.7.15 in a C++ program

by Uwe Lesta :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Jan,

Jan Wielemaker schrieb:

> AFAIK, PL_cleanup() is broken since very long (well, a single
> PL_initialise() ... PL_cleanup() is fine, but repeated usage is broken).

I'll remember.
It was pure luck that the program work with version 5.6.59 so stable.

> I'm not very keen in trying to get this right.  Trying to get unloading
> the foreign resources (DLLs) is very complicated, especially due to the
> various callbacks they may have been registered.

This is what i have done in the CSharp interface.

> Typically, you wouldn't want to re-intialize anyway, because that is
> fairly slow. If you are happy with such long delays, why don't you run
> Prolog in a separate process? That makes restarting safe and easy.
>
> So, what is it that requires you app to re-intialize?

The internal architecture.
I will find a way to implement it as a singleton.

Anyway, thank you for the quick response.

--

Kind regards

Uwe Lesta



_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog