2
votes

Running PHP (CodeIgniter) on Google App Engine, about a third of the time when the page loads the following error occurs...

500 Server Error Error: Server Error The server encountered an error and could not complete your request. Please try again in 30 seconds.

..and in the app engine log:

A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 204)

On-refresh the page loads correctly about 2 out of 3 times. Configuration settings:

php.ini

 

    google_app_engine.enable_functions = "php_sapi_name, gc_enabled"
    display_errors = on
    allow_url_fopen = on
    apc.cache_by_default = 0
    apc.enabled = 0

app.yaml



    application: APP_NAME_ABC123
    version: 1
    runtime: php
    api_version: 1

    handlers:
    - url: /img
      static_dir: img

    - url: /app
      static_dir: app

    - url: /
      script: index.php

    - url: /.*
      script: index.php

3
Do you mind to share the app id so we could look into the issue? Thanks. - Mars
Yes, the app id is opndr-4249 - user1385716
The errors appear to only happen only for a particular URL (/pro/register)? Is this part of CodeIgniter or your own code? - Mars

3 Answers

1
votes

I tested CodeIgniter v2.1 and v3 on app engine and got this error as well.

It happens when using $autoload['libraries'] = array('database');

Then after a few random page refreshes this error pops up.

After changing the following in database.php:

'pconnect' => TRUE,

into

'pconnect' => FALSE,

This errors is gone in my application.

Now both version 2.1 and 3 are working for me.

0
votes

If you are using App Engine instance with Cloud SQL please remember that App Engine cannot have more than 12 concurrent connections to a Cloud SQL instance. So, you need to close the any established connections before processing a request. If you do not do this it will cause a leak may eventually new connection to fail. And that could be one of the reason why you are getting 204 error. I suggest not to use persistent connection by putting persistent attribute false. (As for example if you use PHP Data Object to connect your SQL you can set PDO::ATTR_PERSISTENT => FALSE)

In case of CodeIgniter in the DB Settings sections of your database.php file you can change the line $db['production']['pconnect'] = TRUE; to $db['production']['pconnect'] = FALSE; and see if it works or not.

-1
votes

That has been a pesky, intermittent issue on App Engine for a few years. Google "app engine (Error code 204)" and you'll see others with the same issue. Not sure a user-side solution has ever been found. Try changing your version number and redeploying. Destroy any open instances in the console.