Hello Nicolas,

I found the error. Its in neko_vm_alloc:

  vm->c_stack_max = (void*)(((int_val)&vm) - (stack_size - 0x10000));

when allocating a vm and the stack is lower than stack_size, c_stack_max
has an integer overflow. the next call to val_callEx will fail, even if
there is enough stack. On Windows stack_size is assumed to be at last
1MB (which is quite a lot if you have a lot of threads). I suggest, that
stack_size is down sized if there is an overflow in c_stack_size and
that c_stack_size is min 0x10000

now I help myself with a higher default stack for my application.

Cheers,

Adrian.



Nicolas Cannasse schrieb:
> Adrian Veith a écrit :
>> Hi,
>>
>> when calling neko functions via the CFFI I get randomly C stack overflow
>> exceptions. I am using neko 1.8. The application is multi threaded and
>> since the exceptions do not follow a n obvious pattern, I believe
>> that it is a "thread issue". Are there any known issues ? ( I read in
>> the
>> release notes of neko 1.6: use a smarter way to prevent C stack
>> overflow)
>>
>> Thanks,
>>
>> Adrian.
>
> There was a fix in Neko 1.7.0 related to C stack overflows with
> threads, so I guess there should be no more of these. You can try to
> recompile Neko and check what's occuring in vm/callback.c line 59.
>
> The vm->c_stack_max is initialized in vm/interp.c line 113.
>
> Also, do you use the same VM with different threads ? This might be
> the issue.
>
> Nicolas
>


--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to