I've been working an website that has been going along fine until I introduced newsletter functionality through the Simplenews module. In order to be able to add other Article nodes or Article entities, I added the Entity API and Entity Reference. Then the site started throwing the error "500 Internal Server Error". The error in the error log was: Premature end of script headers: cgi_wrapper.

It wasn't clear to where exactly the error was coming from. At first I thought it was the Simplenews module. Then I thought it was process of e-mailing a Simplenews newsletter that included an Article with a video. Finally I narrowed it down to the Entity API and the Entity Reference module. when the site would go down I would attempt to revive the site with db dump or backup created through the Backup and Migrate module. I was only successful with db backups that did not include the Entity API and Entity Reference enabled. Finally I narrowed it down to Entity API with the following test:
I enabled Entity API and kept Entity Reference disabled.
I created a db backup then attempted to replace the current db with the backed up db.
First I used the restore functionality form Backup and Migrate.
The site went down.
I restored the site with a good db backup (Entity modules disabled).
I attempted to replace the current db with the backup through PHPmyadmin
The site went down again.

I have Drupal 7.14
Entity Reference 7.x-1.0-rc5
Entity API 7.x-1.0-rc3
Simplenews 7.x-1.0+3-dev

Any suggestions.

Comments

kscheirer’s picture

500 errors are generally the webserver complaining that something is misconfigured. Can you check your servers error log and/or php error log, and find any messages at the time of your server crashes?

TomSherlock’s picture

But what could be misconfigured? And why does it only happen when I enabled the Entity API module?

Here are the errors that occur when the site goes down:

[Thu Oct 25 11:11:51 2012] [warn] [client 96.242.26.179] Timeout waiting for output from CGI script /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
[Thu Oct 25 11:34:20 2012] [warn] [client 96.242.26.179] Timeout waiting for output from CGI script /var/www/cgi-bin/cgi_wrapper/cgi_wrapper, referer: http://staging.rcredits.org/admin/config/system/backup_migrate/restore?r...
[Thu Oct 25 11:34:20 2012] [error] [client 96.242.26.179] Script timed out before returning headers: cgi_wrapper, referer: http://staging.rcredits.org/admin/config/system/backup_migrate/restore?r...
[Thu Oct 25 11:37:04 2012] [error] [client 96.242.26.179] Premature end of script headers: cgi_wrapper, referer: http://staging.rcredits.org/user/21
[Thu Oct 25 11:55:30 2012] [error] [client 96.242.26.179] Premature end of script headers: cgi_wrapper

According to some comments these above errors seem to indicate that more memory is needed.
I have the following PHP settings for memory, etc:

memory_limit = 1024M
max_execution_time = 180
max_input_time = 180

I fail to see how simply enabling the module could eat up 1024M, unless there were a memory leak in the module due to something such as an infinite loop.

It is is shame that this is happing with this module. It's essentially a show stopper. I cannot set up the newsletter properly without the Entity API.

ralph.mueller.de’s picture

Actually - got the same experience.

Installed the module by hand (copy into sites/all/modules), server problems ...

Delete module again, site works fine.

I would consider this a bug, eh? Can the developer help us?

capellic’s picture

There is a lot of voodoo surrounding Entity API/Entity Token. Check out this case #1267966: Pathauto patterns are not showing up and specifically this comment:

http://drupal.org/node/1267966#comment-6850104

gillisig’s picture

Edit: Nevermind, I was experiencing this because of a stupid reason that has nothing to do with this module :)

fago’s picture

Category: bug » support

Probably a memory issue or so - trial and error.

Russell Mann’s picture

What reason?

geocalleo’s picture

So umm ... what was the reason? It would be helpful to explain for others experiencing the same issue.

Thanks

TR’s picture

Status: Active » Closed (cannot reproduce)
pierregermain’s picture

In our case it was that we have like 100 fields in a content type. Reducing the number seems to solve this problem.

Update: We deleted and readded the entity reference field that was causing this error, and now the error did not appear again.
We don't know the reason of the error, maybe a misconfiguration at Content Type > Display Form configuration.