Stored Prodecure with MSSQL 500 response

I know this issue was brought up here but there was no resolution in that thread.

I’m using bitnami DF 1.9.1 with a service that connects to MSSQL.

I created my first stored procedure the other day - a simple join table. The response contains a little over 10,000 rows of data. It was working just fine for me. Then I assigned one of my roles to have access to that stored procedure and it mostly stopped working. I’m not sure if the role access edit is related, but it was a pretty immediate change. Since then the stored procedure has worked less and less. At first it was working 50% of the time. Now it works maybe 5% of the time. The rest of the time it returns an empty 500 response.

The stored procedure works with no errors if executed directly on the sql server. I’ve since tried re-creating the same procedure many times without adding any access to roles. But it essentially never works. I’ve also tried calling the stored procedure from a server-side script, but got the same response.

This morning I created a stored procedure that returns 1800 rows and it seems to be working fine via the API. So I guess the issue is the 10,000 rows of data being returned. But it is strange that I was able to receive all those rows with no problem at least 20 times before it started acting up. Am I over-flowing some sort of memory somewhere on df?

It does sound like a memory concern to me. What have you tuned your PHP’s memory settings to? Are you seeing any memory errors in the Apache logs? Might as well check DSP logs, too, to ensure the errors are PHP/Apache and not DSP itself.

I haven’t changed anything in the PHP memory settings. They’d be whatever the default Bitnami install provides.

Apache log says this after running the request:
[Tue Apr 14 17:42:22.501789 2015] [proxy_fcgi:error] [pid 45305:tid 140634014811904] [client 173.165.52.150:62689] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 81 bytes) in /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/lib-php-common-platform/src/Utility/DataFormatter.php on line 921\n\xe8\x7f’, referer: http://127.0.0.1:8080/relay/apps/safetag/index.html

That doesn’t mean too much to me, except that it seems to be a memory issue. But I’m not sure what to change. Any help would be much appreciated.

Thanks!

That is definitely a memory issue. PHP administration is beyond the purview of DSP, but I do believe that the Bitnami stacks come with a default setting in php.ini of memory_limit = 128M.

If you plan to host a production PHP application like DSP, I recommend researching PHP configuration and tuning your server appropriately for your expected number of users, throughput of data, server hardware, etc. Here is PHP’s documentation on memory_limit:

http://php.net/manual/en/ini.core.php#ini.sect.resource-limits

Thanks Jeffrey. Set it to 512MB for now and that seems to be working. I guess I’ll leave it at that unless/until I run into more issues.

1 Like