Stack Space Allocation

I’m using a 32bit client with a 64bit server. I have a method marked with the Execute on Server property that calls a method in our plugin.

When I call the method marked with the Execute on Server property, the process on the server is always allocated about 280kb of stack space. This causes a stack overflow in the plugin (exception code 0xC00000FD).
I’ve also tried running this Execute on Server method from its own parent process on the client with a hardcoded stack size of 560kb, but it still receives 280kb of stack space when it runs on the server.

If I call the method using the command Execute on Server from the client with a stack size of 0, the process gets about 540kb for a stack size and the plugin command runs fine.

Running the plugin command in its own server process works fine.

Out of curiosity, is there a way to increase the stack size of a method that has the Execute on Server attribute enabled? It seems like these methods run similar to triggers.

Thank you,
Seth Leeper
Software Engineer
Orchard Software

Have you tried
http://livedoc.4d.com/4Dv16-R5/help/Command/en/page642.htmlSET
DATABASE PARAMETER> with selector 53, Server base process stack size
?

:

Server base process stack size Longint 53 Scope: 4D Server
Kept between two sessions: No
Possible values: Positive longint.

Description: Size of the stack allocated to each preemptive system
process on the server, expressed in bytes. The default size is
determined by the system.

Preemptive system processes (processes of the 4D client base process
type) are loaded to control the main 4D client processes. The size
allocated by default to the stack of each preemptive process allows a
good ease of execution but may prove to be consequential when very
large numbers of processes (several hundred) are created.

For optimization purposes, this size can be reduced considerably if
the operations carried out by the database allow for it (for example
if the database does not carry out sorts of large quantities of
records). Values of 512 or even 256 KB are possible. Be careful,
under-sizing the stack is critical and can be harmful to the
operation of 4D Server. Setting this parameter should be done with
caution and must take the database conditions of use into account
(number of records, type of operations, etc.).

In order to be taken into account, this parameter must be executed on
the server machine (for example in the On Server Startup Database
Method).

see also: http://kb.4d.com/assetid=76031Tech Tip: Changing 4D Server stack sizes in 4D v11 SQL>

This didn’t work for me, but I think you are on to something.

“Server tasks” might be what I want in the resource file. I will try to get that working.

Was not able to optimize the function nor find a way to increase the stack size of an EOS method without increasing the stack size for all server tasks. I decided in the end to add a check for a minimum stack size (no try/catch in c).