On 2013-04-30, Oleh <
oleh.lo...@gmail.com> wrote:
> I took me some time to catch it with some useful output.
Good to be able to generate a call stack. The bad news is that call
stacks rarely help in debugging GC issues. This is because the
damage generally happened long before the actual crash :-(
> Here is the call stack (its windows), I have used swi-prolog-6.0.2 (still need to get to 6.2.6 ... I know, but soon :)
>
> Can you please advise or hint why is it that prolog is not throwing any Exception? The PL_call_predicate has "PL_Q_NODEBUG | PL_Q_CATCH_EXCEPTION" flags, as of my understanding I should be able to catch it after the call?
That only catches nice Prolog exceptions. Here, you are in unforeseen land.
The first step would be to try the current development releases. Quite a
few bugs have been fixed (e.g. 6.3.14). The second step is to package the
whole stuff, such that it can be reproduced and contact
bu...@swi-prolog.org
(include the code if it is small and no secret, otherwise we'll find some
way to transfer it and/or keep it secret).
If you want to go the whole way yourself, the first step is to recompile
after adding -DSECURE_GC to the COFLAGS in Makefile. Quite likely, that
will tell us that that there is a memory inconsistency when GC starts.
Next, the typical process is to insert additional calls to checkStacks(NULL)
at meaningful places in the source until you know what is corrupting the
stacks. This is a somewhat tricky process because checkStacks() is
rather expensive, so you have to be careful where to add it not to make
you wait for hours for the next crash. Then, there are built-in
predicates that deliberately do things that cause the stacks to
temporary contain invalid Prolog data, so you should not call
checkStacks there. Anyway, most often it is a built in predicate
doing this and if you can checks the stacks to be ok at entry and
broken at exit, you are getting close.
But, again, try 6.3.14 first ...
Success --- Jan
>
> Thank you!
>
> Cheers
> Oleh
>
> -------------
>
>> ntdll.dll!0000000076ef15da()
> [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> ntdll.dll!0000000076ec418b()
> msvcr90.dll!00000000741e1b8b()
> swipl.dll!PL_halt(int status=0x20200080) Line 3772 + 0x8 bytes C
> swipl.dll!vsysError(const char * fm=0x0000000000000000, char * args=0x000000001f5c9dc0) Line 1471 C
> swipl.dll!sysError(const char * fm=0x0000000019074328, ...) Line 1385 C
> swipl.dll!sweep_stacks(vm_state * state=0x00000000204d04b0) Line 2606 C
> swipl.dll!collect_phase(vm_state * state=0x0000000020200080, unsigned __int64 * * saved_bar_at=0x0000000000000000) Line 2894 C
> swipl.dll!garbageCollect() Line 3759 C
> swipl.dll!ensureGlobalSpace(unsigned __int64 cells=0x000000001f5ca3a0, int flags=0x000000dd) Line 3942 C
> swipl.dll!prolog_list_to_sort_list(unsigned __int64 t=0x000000001f5c2db0, int remove_dups=0x000000de, int key=0x00000001, List_Record * * lp=0x000000001f5ca3d0, unsigned __int64 * * end=0x00000000211eeba8) Line 349 + 0xe bytes C
> swipl.dll!pl_nat_sort(unsigned __int64 in=0x00000000000000dd, unsigned __int64 out=0x0000000000000021, int remove_dups=0x18f70000, int compare_keys=0x20200080, PL_local_data * __PL_ld=0x0000000020200080) Line 425 + 0x28 bytes C
> swipl.dll!pl_sort2_va(unsigned __int64 PL__t0=0x0000000018f70000, int PL__ac=0x20200080, foreign_context * PL__ctx=0x0000000018e58910) Line 442 + 0x15 bytes C
> swipl.dll!PL_next_solution(unsigned __int64 qid=0x0000000000000021) Line 3379 C
> swipl.dll!PL_call_predicate(module * ctx=0x00000000e03471a7, int flags=0x211ef0c0, procedure * pred=0x00000000e03471a7, unsigned __int64 h0=0x00000000211ef188) Line 3468 C
> libmypl.dll!000007fefab852eb()
>
> -------------
>
>