If the user presses STOP while drupal is still executing, it will be aborted. If at this point, some db writes have occured, but not others, the db will be left in an inconsistent state.

http://php.net/manual/en/features.connection-handling.php

This patch adds

ini_set('ignore_user_abort', 1);

to settings.php to prevent drupal's execution being interrupted by the user pressing STOP.

CommentFileSizeAuthor
#3 ignore_user_abort2.patch710 bytesjbrown
ignore_user_abort.patch385 bytesjbrown

Comments

moshe weitzman’s picture

hmmm. i wonder if the cure is as bad as the disease. sometimes it is good that user can stop an infinite loop error, for example. just playing devil's advocate really.

jbrown’s picture

Maybe it should be disabled for uid 1? Having ordinary users able to stop the execution is a bad idea.

max_execution_time will catch any runaway execution.

jbrown’s picture

StatusFileSize
new710 bytes

Okay - this patch only activates ignore_user_abort for users other than uid 1.

catch’s picture

Status: Needs review » Needs work

If it's going to stop uid 1, then it should probably apply to anyone with administer site configuration permission for the same reason. Assuming it's desirable in the first place.

mykle’s picture

isn't this what table locking & transactions are for?

chx’s picture

Status: Needs work » Closed (won't fix)

PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client.

This buys us nothing because the way Drupal is created, there is no attempt to send information to the client --aside from a few header calls in the very beginning-- until almost the very end of index.php.