I found a code efficiency that serves as a workaround to the problem for now.

Apparently there is a server memory limit per thread, and my code was bumping against it when processing a large array. Last night I changed my problem code from something like this:

    get arrayEncode(tBigArrayA)
    put base64Encode(it) into it2
    put urlEncode(it2) -- output to requesting app

to something like this:

    put urlEncode(base64Encode(arrayEncode(tBigArrayA)))

and the "internal server error" went away when processing the big array.

So my original statements, in their uncompounded form, were easier for humans (at least for me) to comprehend but multiplied the memory resources needed for the code to execute successfully under large-data conditions. But by putting the functions together in a single compound statement, variables were eliminated which decreased resource demand, and the server's memory limit became a non-issue (at least for now).

That's what I learned.

Best -
Phil Davis




On 6/24/13 5:50 PM, Phil Davis wrote:
Hi Folks,

My on-rev LC server code takes data from many files and organizes it into an array. It then arrayEncodes and base64Encodes the array and "puts" it to the requesting app.

Normally the code works as expected, but when the encoded array approaches 8 MB, an internal server error (500) occurs. It seems to happen after the arrayEncode() executes and before (or when) base64Encode() is executed. (The two functions are back-to-back in the code.) Again, this only happens when the encoded array is approaching 8 MB in size.

Is there an Apache setting or maybe a Linux setting that enforces an 8 MB limit on thread size or something similar? That seems the most likely suspect of my problem to me. If so, can I increase the limit? Can you tell me how?

Thanks for your time.


--
Phil Davis


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to